当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript selenium-webdriver.By类代码示例

本文整理汇总了TypeScript中selenium-webdriver.By的典型用法代码示例。如果您正苦于以下问题:TypeScript By类的具体用法?TypeScript By怎么用?TypeScript By使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了By类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: TestUntilModule

function TestUntilModule() {
    let driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    let conditionB: webdriver.Condition<boolean> = new webdriver.Condition<boolean>('message', (driver: webdriver.WebDriver) => true);
    let conditionBBase: webdriver.Condition<boolean> = conditionB;
    let conditionWebElement: webdriver.WebElementCondition;
    let conditionWebElements: webdriver.Condition<webdriver.WebElement[]>;

    conditionB = webdriver.until.ableToSwitchToFrame(5);
    let conditionAlert: webdriver.Condition<webdriver.Alert> = webdriver.until.alertIsPresent();
    let el: webdriver.WebElement = driver.findElement(webdriver.By.id('id'));
    conditionB = webdriver.until.stalenessOf(el);
    conditionB = webdriver.until.titleContains('text');
    conditionB = webdriver.until.titleIs('text');
    conditionB = webdriver.until.titleMatches(/text/);
    conditionB = webdriver.until.urlContains('text');
    conditionB = webdriver.until.urlIs('text');
    conditionB = webdriver.until.urlMatches(/text/);

    conditionWebElement = webdriver.until.elementIsDisabled(el);
    conditionWebElement = webdriver.until.elementIsEnabled(el);
    conditionWebElement = webdriver.until.elementIsNotSelected(el);
    conditionWebElement = webdriver.until.elementIsNotVisible(el);
    conditionWebElement = webdriver.until.elementIsSelected(el);
    conditionWebElement = webdriver.until.elementIsVisible(el);
    conditionWebElement = webdriver.until.elementLocated(webdriver.By.id('id'));
    conditionWebElement = webdriver.until.elementTextContains(el, 'text');
    conditionWebElement = webdriver.until.elementTextIs(el, 'text');
    conditionWebElement = webdriver.until.elementTextMatches(el, /text/);
    conditionWebElements = webdriver.until.elementsLocated(webdriver.By.className('class'));
}
开发者ID:Rick-Kirkham,项目名称:DefinitelyTyped,代码行数:33,代码来源:index.ts

示例2: return

 return () => {
     // self._driver.get(page.URL);
     self._driver.findElement(By.css(page.LOGIN)).sendKeys('wronglogin@test.test');
     self._driver.findElement(By.css(page.PASS)).sendKeys('159236');
     self._driver.findElement(By.css(page.SUBMIT)).click();
     self._driver.wait(until.elementLocated(By.css(page.ERROR)));
     self._driver.quit();
 };
开发者ID:natalialin,项目名称:Pult-autotests,代码行数:8,代码来源:login-negative.ts

示例3: it

	it('should be possible to click the "allow and install" button', async function() {
		this.timeout(20000);
		this.slow(15000);
		await wait(3000);
		await findElement(webdriver.By.tagName('install-page'))
			.findElement(webdriver.By.tagName('install-confirm'))
			.findElement(webdriver.By.id('acceptAndInstallbutton'))
			.click();
		await wait(5000);
	});
开发者ID:SanderRonde,项目名称:CustomRightClickMenu,代码行数:10,代码来源:installation-test.ts

示例4: _getRatesForIndicative

    private _getRatesForIndicative(skipOptionClick) {
        var promises = [];
        if (!skipOptionClick) {
            promises.push(this._waitAndClick(By.xpath(`//*[@id='nonINRradio']/*[@id='moneyType']`)));
        }
        promises.push(driver.wait(until.elementLocated(By.xpath(`//*[@id="txnAmountDiv1"]/input`)), 5 * 1000)
            .then(el => el.sendKeys('1000')));
        promises.push(this._waitAndClick(By.xpath(`//a[@onclick='calculate();']`)));

        return promise.all(promises)
            .then(_ => this._extractRates(true))
            .then(resultPromise => promise.all(resultPromise));
    }
开发者ID:vmanikandan001,项目名称:xcngr,代码行数:13,代码来源:m2indiaProvider.ts

示例5: _setSearchParameters

    private _setSearchParameters(currency, transferMode, deliveryMode) {
        driver.get(URL);
        var locators = [
            By.xpath(`//*[@id='currencyId']/option[text()='${currency}'] `),
            By.xpath(`//*[@id='product']/option[text()='${transferMode}'] `),
            By.xpath(`//*[@id='deliveryMode']/option[text()='${deliveryMode}']`)];

        var promises = locators.map(locator => this._waitAndClick(locator));

        return promise.all(promises)
            .then(_ => console.log(`Search parameters currency: ${currency}, transferMode:${transferMode}, deliveryMode: ${deliveryMode} set successfully`))
            .thenCatch(err => console.log(`Error while setting search parameters currency: 
                ${currency}, transferMode:${transferMode}, deliveryMode: ${deliveryMode}. Error: ${err.message}`));
    }
开发者ID:vmanikandan001,项目名称:xcngr,代码行数:14,代码来源:m2indiaProvider.ts

示例6: openOptionsPage

export async function openOptionsPage(driver: TypedWebdriver, capabilities: BrowserstackCapabilities) {
	const version = getVersion(capabilities);
	
	await wait(500);

	const extensionElement = await findExtensionElement(driver, capabilities);
	if (!extensionElement) {
		console.error('Failed to find extension options page');
		process.exit(1);
		return;
	}

	if (version < 66) {
		await extensionElement
			.findElement(webdriver.By.className('options-link'))
			.click();
		const currentTab = await driver.getWindowHandle();
		const tabs = await driver.getAllWindowHandles();
		const nonCurrentTabs = tabs.filter((tab) => {
			return tab !== currentTab;
		});
		
		//Close the curent tab
		await driver.close();

		//Switch to next tab
		await driver.switchTo().window(nonCurrentTabs[0]);
		return;
	} else {
		await findElement(webdriver.By.tagName('extensions-manager'))
			.findElement(webdriver.By.tagName('extensions-detail-view'))
			.findElement(webdriver.By.id('extensions-options'))
			.click();

		const currentTab = await driver.getWindowHandle();
		const tabs = await driver.getAllWindowHandles();
		const nonCurrentTabs = tabs.filter((tab) => {
			return tab !== currentTab;
		});
		
		//Close the curent tab
		await driver.close();

		//Switch to next tab
		await driver.switchTo().window(nonCurrentTabs[0]);
		return;
	}
}
开发者ID:SanderRonde,项目名称:CustomRightClickMenu,代码行数:48,代码来源:chrome-extension.ts

示例7: _getIndicativeRate

    private _getIndicativeRate(pageMap) {
        driver.get(URL);
     

        driver.wait(until.elementLocated(By.css("#paymentAmount")), 5 * 1000)
            .then(el => el.sendKeys("1"));
            
             //  driver.wait(until.elementLocated(By.xpath(`//*[@id="paymentCurrencies"]/option[text()="${pageMap.currencyValue}"]`)), 15 * 1000)
            //.then(el => el.click());

        driver.findElement(By.xpath(`//*[@id='deliveryCountries']/option[text()='India']`))
             .then(el => el.click())

        // driver.findElement(By.css("#deliveryAmount"))
        //     .then(el => el.getText().then(text => console.log(text)));
    }
开发者ID:vmanikandan001,项目名称:xcngr,代码行数:16,代码来源:xendpayProvider.ts

示例8: loginPositive

  public loginPositive(email, pass, callback) {
    let pageLogin = new LoginPage(this._driver);
    let page = new Page();
    let pageSideMenu = new SideMenu();

    console.log('start test');
    pageLogin.openPage();
    // this._driver.findElement(By.css(page.LOGIN)).sendKeys(email);
    pageLogin.getLogin().sendKeys(email);
    pageLogin.getPass().sendKeys(pass);
    pageLogin.getSubmit().click();
    pageLogin.waitToLocateIWE();
    page.waitToLocateIWE( pageSideMenu._settingsBtn);
    page.getElementByCss(pageSideMenu._settingsBtn).click();
    pageLogin.getElementCss(
        By.css('body > div:nth-child(4) > div > div > div > ' +
            'div:nth-child(3) > div:nth-child(5) > button')).click();
    // page.waitToLocateIWE()
    // let loginLocator = page.waitToLocateIWE(pageLogin._login);

    loginLocator.then(() => {
      callback();
    });
    // this._driver.quit()
  }
开发者ID:natalialin,项目名称:Pult-autotests,代码行数:25,代码来源:login-positive.ts

示例9: TestWebElement

function TestWebElement() {
    var driver: webdriver.WebDriver = new webdriver.Builder().
        withCapabilities(webdriver.Capabilities.chrome()).
        build();

    var promise: webdriver.promise.Promise<string>;
    var element: webdriver.WebElement;

    element = new webdriver.WebElement(driver, 'elementId');
    element = new webdriver.WebElement(driver, promise);

    var voidPromise: webdriver.promise.Promise<void>;
    var stringPromise: webdriver.promise.Promise<string>;
    var booleanPromise: webdriver.promise.Promise<boolean>;

    voidPromise = element.clear();
    voidPromise = element.click();

    element = element.findElement(webdriver.By.id('ABC'));
    element.findElements(webdriver.By.className('ABC')).then(function (elements: webdriver.WebElement[]) { });
    booleanPromise = element.isElementPresent(webdriver.By.className('ABC'));

    stringPromise = element.getAttribute('class');
    stringPromise = element.getCssValue('display');
    driver = element.getDriver();
    stringPromise = element.getInnerHtml();
    element.getLocation().then(function (location: webdriver.ILocation) { });
    stringPromise = element.getOuterHtml();
    element.getSize().then(function (size: webdriver.ISize) { });
    stringPromise = element.getTagName();
    stringPromise = element.getText();
    booleanPromise = element.isDisplayed();
    booleanPromise = element.isEnabled();
    booleanPromise = element.isSelected();
    voidPromise = element.sendKeys('A', 'B', 'C');
    voidPromise = element.sendKeys(1, 2, 3);
    voidPromise = element.sendKeys(webdriver.Key.BACK_SPACE);
    voidPromise = element.sendKeys(stringPromise, stringPromise, stringPromise);
    voidPromise = element.sendKeys('A', 1, webdriver.Key.BACK_SPACE, stringPromise);
    voidPromise = element.submit();
    element.getId().then(function (id: string) { });
    element.getRawId().then(function (id: string) { });
    element.serialize().then(function (id: webdriver.IWebElementId) { });

    booleanPromise = webdriver.WebElement.equals(element, new webdriver.WebElement(driver, 'elementId'));
}
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:46,代码来源:index.ts


注:本文中的selenium-webdriver.By类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。