mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
WIP: Add webdriver.By.Hash
`webdriver.By.Hash` is a Closure Llibrary style type alias. If we assign `webdriver.By.Hash`, we get an `undefined`. I think the assignment should have an error, because it have no meanings.
This commit is contained in:
@@ -528,6 +528,16 @@ function TestLocator() {
|
||||
locator = webdriver.By.tagName('tag');
|
||||
locator = webdriver.By.xpath('xpath');
|
||||
|
||||
var locatorHash: webdriver.By.Hash;
|
||||
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(function (abc: number) { });
|
||||
}
|
||||
|
||||
|
||||
34
selenium-webdriver/selenium-webdriver.d.ts
vendored
34
selenium-webdriver/selenium-webdriver.d.ts
vendored
@@ -4783,6 +4783,40 @@ declare module webdriver {
|
||||
|
||||
var By: ILocatorStrategy;
|
||||
|
||||
module By {
|
||||
/**
|
||||
* Short-hand expressions for the primary element locator strategies.
|
||||
* For example the following two statements are equivalent:
|
||||
*
|
||||
* var e1 = driver.findElement(webdriver.By.id('foo'));
|
||||
* var e2 = driver.findElement({id: 'foo'});
|
||||
*
|
||||
* Care should be taken when using JavaScript minifiers (such as the
|
||||
* Closure compiler), as locator hashes will always be parsed using
|
||||
* the un-obfuscated properties listed.
|
||||
*
|
||||
* @typedef {(
|
||||
* {className: string}|
|
||||
* {css: string}|
|
||||
* {id: string}|
|
||||
* {js: string}|
|
||||
* {linkText: string}|
|
||||
* {name: string}|
|
||||
* {partialLinkText: string}|
|
||||
* {tagName: string}|
|
||||
* {xpath: string})}
|
||||
*/
|
||||
type Hash = {className: string}|
|
||||
{css: string}|
|
||||
{id: string}|
|
||||
{js: string}|
|
||||
{linkText: string}|
|
||||
{name: string}|
|
||||
{partialLinkText: string}|
|
||||
{tagName: string}|
|
||||
{xpath: string};
|
||||
}
|
||||
|
||||
/**
|
||||
* An element locator.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user