本文整理汇总了TypeScript中selenium-webdriver.By.name方法的典型用法代码示例。如果您正苦于以下问题:TypeScript By.name方法的具体用法?TypeScript By.name怎么用?TypeScript By.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium-webdriver.By
的用法示例。
在下文中一共展示了By.name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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) => {});
}
示例2:
flow.execute(() => {
driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys('webdriver');
driver.findElement(By.name('btnG')).click();
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
});
示例3:
toolkit.dataFlush<ISearch>(search, (item) => {
driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys(item.query);
driver.findElement(By.name('btnG')).click();
driver.wait(until.titleIs(item.query + ' - Google Search'), 1000);
});