Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 6f3a02f

Browse files
committed
docs(webdriver): protractor style docs for getDriver, getId, and click (#3101)
1 parent 574cb66 commit 6f3a02f

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

lib/selenium-webdriver/webdriver.js

+39-2
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,38 @@ webdriver.WebElement = function(driver, id) {};
7171
goog.inherits(webdriver.WebElement, webdriver.Serializable);
7272

7373
/**
74+
* Gets the parent web element of this web element.
75+
*
76+
* @view
77+
* <ul class="pet">
78+
* <li class="dog">Dog</li>
79+
* <li class="cat">Cat</li>
80+
* </ul>
81+
*
82+
* @example
83+
* // Using getDriver to find the parent web element to find the cat li
84+
* var liDog = element(by.css('.dog')).getWebElement();
85+
* var liCat = liDog.getDriver().findElement(by.css('.cat'));
86+
*
7487
* @return {!webdriver.WebDriver} The parent driver for this instance.
7588
*/
7689
webdriver.WebElement.prototype.getDriver = function() {};
7790

7891

7992
/**
93+
* Gets the WebDriver ID string representation for this web element.
94+
*
95+
* @view
96+
* <ul class="pet">
97+
* <li class="dog">Dog</li>
98+
* <li class="cat">Cat</li>
99+
* </ul>
100+
*
101+
* @example
102+
* // returns the dog web element
103+
* var dog = element(by.css('.dog')).getWebElement();
104+
* expect(dog.getId()).not.toBe(undefined);
105+
*
80106
* @return {!webdriver.promise.Promise.<webdriver.WebElement.Id>} A promise
81107
* that resolves to this element's JSON representation as defined by the
82108
* WebDriver wire protocol.
@@ -115,6 +141,17 @@ webdriver.WebElement.prototype.findElement = function(subLocator) {};
115141

116142
/**
117143
* Schedules a command to click on this element.
144+
*
145+
* @view
146+
* <ul>
147+
* <li><a href="https://en.wikipedia.org/wiki/Doge_(meme)">Doge meme</a></li>
148+
* <li>Cat</li>
149+
* </ul>
150+
*
151+
* @example
152+
* // Clicks on the web link
153+
* element(by.partialLinkText('Doge')).click();
154+
*
118155
* @return {!webdriver.promise.Promise.<void>} A promise that will be resolved
119156
* when the click command has completed.
120157
*/
@@ -183,7 +220,7 @@ webdriver.WebElement.prototype.sendKeys = function(var_args) {};
183220
* @view
184221
* <span>{{person.name}}</span>
185222
*
186-
* @example
223+
* @example
187224
* expect(element(by.binding('person.name')).getTagName()).toBe('span');
188225
*
189226
* @return {!webdriver.promise.Promise.<string>} A promise that will be
@@ -204,7 +241,7 @@ webdriver.WebElement.prototype.getTagName = function() {};
204241
* @view
205242
* <span style='color: #000000'>{{person.name}}</span>
206243
*
207-
* @example
244+
* @example
208245
* expect(element(by.binding('person.name')).getCssValue().indexOf(
209246
* 'color: #000000')).not.toBe(-1);
210247
*

0 commit comments

Comments
 (0)