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:
Kuniwak
2015-07-09 20:39:37 +09:00
parent ecd7cc44b7
commit 03d49ee1b9
2 changed files with 44 additions and 0 deletions

View File

@@ -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) { });
}

View File

@@ -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.
*/