當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript By.xpath方法代碼示例

本文整理匯總了TypeScript中selenium-webdriver.By.xpath方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript By.xpath方法的具體用法?TypeScript By.xpath怎麽用?TypeScript By.xpath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在selenium-webdriver.By的用法示例。


在下文中一共展示了By.xpath方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

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

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

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

示例4: _extractRates

    private _extractRates(isIndicative) {
        var path = `//*[@id="fixslabs"]/table/tbody/tr/td`

        if (isIndicative) {
            path = `//*[@id="slabsMe"]/table/tbody/tr/td`;
        }

        return driver.wait(until.elementsLocated(By.xpath(path)), 5 * 1000)
            .then(els => els.map(el1 => el1.getText()));
    }
開發者ID:vmanikandan001,項目名稱:xcngr,代碼行數:10,代碼來源:m2indiaProvider.ts

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

示例6: it

 it('visits System Configuration', async () => {
     await navigation.visitSystemConfiguration()
     await navigation.blur()
     ctx.driver.findElement(By.xpath("//div[@class='alert alert-danger']"))
 })
開發者ID:ahormazabal,項目名稱:rundeck,代碼行數:5,代碼來源:navigation.test.ts


注:本文中的selenium-webdriver.By.xpath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。