当前位置: 首页>>代码示例>>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;未经允许,请勿转载。