當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。