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


TypeScript By.css方法代码示例

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


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

示例1: 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

示例2: TestBy

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

    let locator: webdriver.By = new webdriver.By('class name', 'class');

    let str: string = locator.toString();

    locator = webdriver.By.className('class');
    locator = webdriver.By.css('css');
    locator = webdriver.By.id('id');
    locator = webdriver.By.linkText('link');
    locator = webdriver.By.name('name');
    locator = webdriver.By.partialLinkText('text');
    locator = webdriver.By.tagName('tag');
    locator = webdriver.By.xpath('xpath');

    // Can import 'By' without import declarations
    let By = webdriver.By;

    let locatorHash: webdriver.ByHash;
    locatorHash = { className: 'class' };
    locatorHash = { css: 'css' };
    locatorHash = { id: 'id' };
    locatorHash = { linkText: 'link' };
    locatorHash = { name: 'name' };
    locatorHash = { partialLinkText: 'text' };
    locatorHash = { tagName: 'tag' };
    locatorHash = { xpath: 'xpath' };

    webdriver.By.js('script', 1, 2, 3)(driver).then((abc: number) => {});
}
开发者ID:Rick-Kirkham,项目名称:DefinitelyTyped,代码行数:33,代码来源:index.ts

示例3: 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

示例4: checkNavTitle

    @AsyncTest("check nav title spelled correctly")
    public async checkNavTitle() {
        const driver = new Builder().
            withCapabilities(Capabilities.chrome()).
            build();
        
        await driver.get("localhost:3000");

        const headingTitle = driver.findElement(By.css("nav h1"));

        const headingText = await headingTitle.getText();
        
        Expect(headingText).toBe("Alsatian");
    }
开发者ID:alsatian-test,项目名称:alsatian-website,代码行数:14,代码来源:example.spec.ts

示例5: findByXPath

// Fake findByXPath for simple XPath expressions to allow usage with shadow dom
async function findByXPath(node: WebElement, path: string): Promise<WebElement> {
     let paths = convertPath(path);
     let n = node;
     try {
        for (let p of paths) {
            // n = n.then(nd => nd.findElements(By.tagName(p.tagName))).then(elems => { // costly since it fetches all elements
           let elems = await n.findElements(By.css(p.tagName+":nth-child("+(p.index)+")"));
           if (elems==null || elems.length==0) { return null}; 
           n = elems[0];
        }   
     } catch (e) {
         //can happen for StaleElementReferenceError
        return null;
     }
     return n;    
}
开发者ID:localvoid,项目名称:js-framework-benchmark,代码行数:17,代码来源:webdriverAccess.ts

示例6: _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

示例7: waitToLocateIWE

 public waitToLocateIWE(locator: string): any {
   return this._driver.wait(until.elementLocated(By.css(locator)), 2000);
 }
开发者ID:natalialin,项目名称:Pult-autotests,代码行数:3,代码来源:page.ts

示例8: getElementCss

 public getElementCss(locator: string): IWebElement {
   this.getDriver().findElement(By.css(locator));
 }
开发者ID:natalialin,项目名称:Pult-autotests,代码行数:3,代码来源:page.ts

示例9: getElementByCss

export function getElementByCss(driver: WebDriver, locator: string): IWebElement {
     return driver.findElement(By.css(locator));
 }
开发者ID:natalialin,项目名称:Pult-autotests,代码行数:3,代码来源:util.ts

示例10:

 n = n.then(nd => nd.findElements(By.css(p.tagName+":nth-child("+(p.index)+")"))).then(elems => {
开发者ID:leeoniya,项目名称:js-framework-benchmark,代码行数:1,代码来源:webdriverAccess.ts


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