Skip to content

Instantly share code, notes, and snippets.

@AutomatedTester
Created November 19, 2013 14:59
Show Gist options
  • Select an option

  • Save AutomatedTester/7546612 to your computer and use it in GitHub Desktop.

Select an option

Save AutomatedTester/7546612 to your computer and use it in GitHub Desktop.
# HG changeset patch
# User David Burns <dburns@mozilla.com>
# Date 1384873169 0
# Tue Nov 19 14:59:29 2013 +0000
# Node ID 10fae496b62ad717963fecb11ce4ca8c7cff2e0d
# Parent bb950710e5b434e2f561075c25b426e8df1d1e8c
imported patch editing
diff --git a/10_element_state.html b/10_element_state.html
--- a/10_element_state.html
+++ b/10_element_state.html
@@ -21,17 +21,17 @@
<p class="note">
Essentially, this attempts to model whether or not a user of the browser could possibly find a way to view the <code>WebElement</code> without resizing the browser window.
</p>
<div class="note">
<p>
The common usage pattern for <code>isDisplayed</code> is typically something similar to (in python):</p>
<pre>
element = driver.find_element(by = TAG_NAME, value= = "button")
- if (element.is_displayed):
+ if element.is_displayed():
element.click()
else
# So other deep magic of the unseen ages.
</pre>
</div>
<table class="simple">
<tr>
<td>Command Name</td>
@@ -47,17 +47,17 @@
<td>{boolean} Whether the element is shown.</td>
</tr>
<tr>
<td>Errors</td>
<td><code><a href="#status-stale-element-reference">stale element reference</a></code> if the element referenced is no longer attached to the DOM.</td>
</tr>
</table>
<p>
- If <code>isDisplayed</code> returns true, then the element MUST also be <a href="#interactable-elements">interable</a> should it meet the other criteria for being interactable. If any part of the BODY can be brought into the current viewport, this MUST return true.
+ If <code>isDisplayed</code> returns true, then the element MUST also be <a href="#interactable-elements">interactable</a> should it meet the other criteria for being interactable. If any part of the BODY can be brought into the current viewport, this MUST return true.
</p>
<div class="note">
<p>This implies that <code>isDisplayed</code> MUST return true if the centre of the element could be brought into the viewport. The exception to this would be the BODY element, which is generally assumed to always be visible by users of the WebDriver spec. It is possible to interact with elements which may not have the centre point brought into the viewport by using the <a href="#low-level-commands">low level commands</a>. This means that if any part of the element could be brought into the viewport by user action and its position could be used by low-level commands then a WebDriver implementation MAY return true.</p>
</div>
</section>
<section>
<h2>Determining Whether a WebElement Is Selected</h2>
diff --git a/11_ecmascript.html b/11_ecmascript.html
--- a/11_ecmascript.html
+++ b/11_ecmascript.html
@@ -76,17 +76,17 @@
<p>When executing JavaScript, the WebDriver implementations MUST use the following algorithm:
<ol>
<li>Let <code>window</code> be the <a href="http://www.w3.org/TR/Window/">Window</a> object for WebDriver's current <a href="#where-commands-are-handled">command context</a>.
<li>Let <code>script</code> be the DOMString from the command's <code>script</code> parameter.
<li>Let <code>fn</code> be the Function object created by executing <code>new Function(script);</code>
<li>Let <code>args</code> be the JavaScript array created by the pre-processing algorithm defined <a href="#JS-args-preprocess">above</a>.
<li>Invoke <code>fn.apply(window, args);</code>
- <li>If step #5 threw, then:
+ <li>If the previous step errors then:
<ol>
<li>Let <code>error</code> be the thrown value.
<li>Set the response's status <a href="#attributes-1">status</a> to <code><a href="#status-javascript-error">javascript error</a></code>.
<li>Set the response value to a dictionary, <code>dict</code>.
<li>If <code>error</code> is an Error, then set a "message" entry in <code>dict</code> whose value is the DOMString defined by <code>error.message</code>.
<li>Otherwise, set a "message" entry in <code>dict</code> whose value is the DOMString representation of <code>error</code>.
</ol>
<li>Otherwise:
@@ -96,17 +96,17 @@
<li>Let <code>value</code> be the result of the following algorithm:
<ol>
<li>If <code>result</code> is:
<ol>
<li><code>undefined</code> or <code>null</code>, return <code> null</code>.
<li>a number, boolean, or DOMString, return <code>result</code>.
<li>a DOMElement, then return the corresponding WebElement for that DOMElement.
<!-- Should there be a recursion limit? -->
- <li>an array or NodeList, then return the result of recursively applying this algorithm to <code>result</code>.
+ <li>a <code>Sequence &lt;Node&gt; nodes</code>, then return the result of recursively applying this algorithm to <code>result</code>.
<!-- Should there be a limit? -->
<li>an object, then return the dictionary created by recursively applying this algorithm to each property in <code>result</code>.
</ol>
</ol>
<li>Set the response value to <code>value</code>.</li>
</ol>
<li>Return the response.</li>
</ol>
@@ -130,59 +130,61 @@
<td>Return Value</td>
<td>{Argument} The value returned by the script, or null.</td>
</tr>
<tr>
<td>Errors</td>
<td>
<code><a href="#status-javascript-error">javascript error</a></code> if the executing script threw an exception.<br />
<code><a href="#status-stale-element-reference">stale element reference</a></code> if a WebElement referenced is no longer attached to the DOM.<br/>
- Timeout if the callback is not called within the time specified by the <a href="#timeouts">"script" timeout</a>.<br/>
+ <code><a href="#status-timeout">Timeout</a></code> if the callback is not called within the time specified by the <a href="#timeouts">"script" timeout</a>.<br/>
<code><a href="#status-unknown-error">unknown error</a></code> if an argument or the return value is of an unhandled type.
</td>
</tr>
</table>
<p>When executing asynchronous JavaScript, the WebDriver implementation MUST use the following algorithm:
<ol>
<li>Let <code>timeout</code> be the value of the last "script" <a href="#timeouts">timeout command</a>, or 0 if no such commands have been received.</li>
<li>Let <code>window</code> be the <a href="http://www.w3.org/TR/Window/">Window</a> object for WebDriver's current <a href="#where-commands-are-handled">command context</a>.</li>
<li>Let <code>script</code> be the DOMString from the command's <code>script</code> parameter.</li>
<li>Let <code>fn</code> be the Function object created by executing <code>new Function(script);</code></li>
<li>Let <code>args</code> be the JavaScript array created by the pre-processing algorithm defined <a href="#JS-args-preprocess">above</a>.</li>
<li>Let <code>callback</code> be a Function object pushed to the end of <code>args</code>.</li>
<li>Register a one-shot timer on <code>window</code> set to fire <code>timeout</code> milliseconds in the future.</li>
<li>Invoke <code>fn.apply(window, args);</code></li>
- <li>If step #8 threw, then:
+ <li>If the previous step errors then:
<ol>
<li>Let <code>error</code> be the thrown value.</li>
<li>Set the response <a href="#attributes-1">status</a> to <code><a href="#status-javascript-error">javascript error</a></code>.</li>
<li>Set the response value to a dictionary, <code>dict</code>.</li>
<li>If <code>error</code> is an Error, then set a "message" entry in <code>dict</code> whose value is the DOMString defined by <code>error.message</code>.</li>
<li>Otherwise, set a "message" entry in <code>dict</code> whose value is the DOMString representation of <code>error</code>.</li>
</ol>
</li>
<li>Otherwise, the WebDriver implementation MUST wait for one of the following to occur:
<ol>
- <li>if the timer from step #7 fires, the WebDriver implementation MUST immediately set the response status to Timeout and return.</li>
+ <li>if the one-shot timer that was set on the <code>window</code> fires
+ , the WebDriver implementation MUST immediately set the response status
+ to <code><a href='#status-timeout'>timeout</a></code> and return.</li>
<li>if the <code>window</code> fires an <code>unload</code> event, the WebDriver implementation MUST immediately set the response status to JavascriptError and return with the error message set to "Javascript execution context no longer exists.".</li>
<li>if the <code>callback</code> function is invoked, then:
<ol>
<li>Let <code>result</code> be the first argument passed to <code>callback</code>.</li>
<li>Set the command's response <a href="#attributes-1">status</a> to Success.</li>
<li>Let <code>value</code> be the result of the following algorithm:
<ol>
<li>If <code>result</code> is:
<ol>
<li><code>undefined</code> or <code>null</code>, return <code> null</code>.</li>
<li>a number, boolean, or DOMString, return <code>result</code>.</li>
<li>a DOMElement, then return the corresponding WebElement for that DOMElement.</li>
<!-- Should there be a recursion limit? -->
- <li>an array or NodeList, then return the result of recursively applying this algorithm to <code>result</code>. WebDriver implementations SHOULD limit the recursion depth.</li>
+ <li>a <code>Sequence &lt;Node&gt; Nodes</code>, then return the result by recursively applying this algorithm to <code>result</code>. WebDriver implementations SHOULD limit the recursion depth.</li>
<!-- Should there be a limit? -->
<li>an object, then return the dictionary created by recursively applying this algorithm to each property in <code>result</code>.</li>
</ol>
</li>
</ol>
</li>
<li>Set the command's response value to <code>value</code>.</li>
</ol>
diff --git a/webdriver-spec.html b/webdriver-spec.html
--- a/webdriver-spec.html
+++ b/webdriver-spec.html
@@ -1144,17 +1144,17 @@ In addition, implementors MAY add additi
<p class="note">
Essentially, this attempts to model whether or not a user of the browser could possibly find a way to view the <code>WebElement</code> without resizing the browser window.
</p>
<div class="note">
<p>
The common usage pattern for <code>isDisplayed</code> is typically something similar to (in python):</p>
<pre>
element = driver.find_element(by = TAG_NAME, value= = "button")
- if (element.is_displayed):
+ if element.is_displayed():
element.click()
else
# So other deep magic of the unseen ages.
</pre>
</div>
<table class="simple">
<tr>
<td>Command Name</td>
@@ -1170,17 +1170,17 @@ In addition, implementors MAY add additi
<td>{boolean} Whether the element is shown.</td>
</tr>
<tr>
<td>Errors</td>
<td><code><a href="#status-stale-element-reference">stale element reference</a></code> if the element referenced is no longer attached to the DOM.</td>
</tr>
</table>
<p>
- If <code>isDisplayed</code> returns true, then the element MUST also be <a href="#interactable-elements">interable</a> should it meet the other criteria for being interactable. If any part of the BODY can be brought into the current viewport, this MUST return true.
+ If <code>isDisplayed</code> returns true, then the element MUST also be <a href="#interactable-elements">interactable</a> should it meet the other criteria for being interactable. If any part of the BODY can be brought into the current viewport, this MUST return true.
</p>
<div class="note">
<p>This implies that <code>isDisplayed</code> MUST return true if the centre of the element could be brought into the viewport. The exception to this would be the BODY element, which is generally assumed to always be visible by users of the WebDriver spec. It is possible to interact with elements which may not have the centre point brought into the viewport by using the <a href="#low-level-commands">low level commands</a>. This means that if any part of the element could be brought into the viewport by user action and its position could be used by low-level commands then a WebDriver implementation MAY return true.</p>
</div>
</section>
<section>
<h2>Determining Whether a WebElement Is Selected</h2>
@@ -1441,17 +1441,17 @@ assertEquals(style, recovered);
<p>When executing JavaScript, the WebDriver implementations MUST use the following algorithm:
<ol>
<li>Let <code>window</code> be the <a href="http://www.w3.org/TR/Window/">Window</a> object for WebDriver's current <a href="#where-commands-are-handled">command context</a>.
<li>Let <code>script</code> be the DOMString from the command's <code>script</code> parameter.
<li>Let <code>fn</code> be the Function object created by executing <code>new Function(script);</code>
<li>Let <code>args</code> be the JavaScript array created by the pre-processing algorithm defined <a href="#JS-args-preprocess">above</a>.
<li>Invoke <code>fn.apply(window, args);</code>
- <li>If step #5 threw, then:
+ <li>If the previous step errors then:
<ol>
<li>Let <code>error</code> be the thrown value.
<li>Set the response's status <a href="#attributes-1">status</a> to <code><a href="#status-javascript-error">javascript error</a></code>.
<li>Set the response value to a dictionary, <code>dict</code>.
<li>If <code>error</code> is an Error, then set a "message" entry in <code>dict</code> whose value is the DOMString defined by <code>error.message</code>.
<li>Otherwise, set a "message" entry in <code>dict</code> whose value is the DOMString representation of <code>error</code>.
</ol>
<li>Otherwise:
@@ -1461,17 +1461,17 @@ assertEquals(style, recovered);
<li>Let <code>value</code> be the result of the following algorithm:
<ol>
<li>If <code>result</code> is:
<ol>
<li><code>undefined</code> or <code>null</code>, return <code> null</code>.
<li>a number, boolean, or DOMString, return <code>result</code>.
<li>a DOMElement, then return the corresponding WebElement for that DOMElement.
<!-- Should there be a recursion limit? -->
- <li>an array or NodeList, then return the result of recursively applying this algorithm to <code>result</code>.
+ <li>a <code>Sequence &lt;Node&gt; nodes</code>, then return the result of recursively applying this algorithm to <code>result</code>.
<!-- Should there be a limit? -->
<li>an object, then return the dictionary created by recursively applying this algorithm to each property in <code>result</code>.
</ol>
</ol>
<li>Set the response value to <code>value</code>.</li>
</ol>
<li>Return the response.</li>
</ol>
@@ -1495,59 +1495,61 @@ assertEquals(style, recovered);
<td>Return Value</td>
<td>{Argument} The value returned by the script, or null.</td>
</tr>
<tr>
<td>Errors</td>
<td>
<code><a href="#status-javascript-error">javascript error</a></code> if the executing script threw an exception.<br />
<code><a href="#status-stale-element-reference">stale element reference</a></code> if a WebElement referenced is no longer attached to the DOM.<br/>
- Timeout if the callback is not called within the time specified by the <a href="#timeouts">"script" timeout</a>.<br/>
+ <code><a href="#status-timeout">Timeout</a></code> if the callback is not called within the time specified by the <a href="#timeouts">"script" timeout</a>.<br/>
<code><a href="#status-unknown-error">unknown error</a></code> if an argument or the return value is of an unhandled type.
</td>
</tr>
</table>
<p>When executing asynchronous JavaScript, the WebDriver implementation MUST use the following algorithm:
<ol>
<li>Let <code>timeout</code> be the value of the last "script" <a href="#timeouts">timeout command</a>, or 0 if no such commands have been received.</li>
<li>Let <code>window</code> be the <a href="http://www.w3.org/TR/Window/">Window</a> object for WebDriver's current <a href="#where-commands-are-handled">command context</a>.</li>
<li>Let <code>script</code> be the DOMString from the command's <code>script</code> parameter.</li>
<li>Let <code>fn</code> be the Function object created by executing <code>new Function(script);</code></li>
<li>Let <code>args</code> be the JavaScript array created by the pre-processing algorithm defined <a href="#JS-args-preprocess">above</a>.</li>
<li>Let <code>callback</code> be a Function object pushed to the end of <code>args</code>.</li>
<li>Register a one-shot timer on <code>window</code> set to fire <code>timeout</code> milliseconds in the future.</li>
<li>Invoke <code>fn.apply(window, args);</code></li>
- <li>If step #8 threw, then:
+ <li>If the previous step errors then:
<ol>
<li>Let <code>error</code> be the thrown value.</li>
<li>Set the response <a href="#attributes-1">status</a> to <code><a href="#status-javascript-error">javascript error</a></code>.</li>
<li>Set the response value to a dictionary, <code>dict</code>.</li>
<li>If <code>error</code> is an Error, then set a "message" entry in <code>dict</code> whose value is the DOMString defined by <code>error.message</code>.</li>
<li>Otherwise, set a "message" entry in <code>dict</code> whose value is the DOMString representation of <code>error</code>.</li>
</ol>
</li>
<li>Otherwise, the WebDriver implementation MUST wait for one of the following to occur:
<ol>
- <li>if the timer from step #7 fires, the WebDriver implementation MUST immediately set the response status to Timeout and return.</li>
+ <li>if the one-shot timer that was set on the <code>window</code> fires
+ , the WebDriver implementation MUST immediately set the response status
+ to <code><a href='#status-timeout'>timeout</a></code> and return.</li>
<li>if the <code>window</code> fires an <code>unload</code> event, the WebDriver implementation MUST immediately set the response status to JavascriptError and return with the error message set to "Javascript execution context no longer exists.".</li>
<li>if the <code>callback</code> function is invoked, then:
<ol>
<li>Let <code>result</code> be the first argument passed to <code>callback</code>.</li>
<li>Set the command's response <a href="#attributes-1">status</a> to Success.</li>
<li>Let <code>value</code> be the result of the following algorithm:
<ol>
<li>If <code>result</code> is:
<ol>
<li><code>undefined</code> or <code>null</code>, return <code> null</code>.</li>
<li>a number, boolean, or DOMString, return <code>result</code>.</li>
<li>a DOMElement, then return the corresponding WebElement for that DOMElement.</li>
<!-- Should there be a recursion limit? -->
- <li>an array or NodeList, then return the result of recursively applying this algorithm to <code>result</code>. WebDriver implementations SHOULD limit the recursion depth.</li>
+ <li>a <code>Sequence &lt;Node&gt; Nodes</code>, then return the result by recursively applying this algorithm to <code>result</code>. WebDriver implementations SHOULD limit the recursion depth.</li>
<!-- Should there be a limit? -->
<li>an object, then return the dictionary created by recursively applying this algorithm to each property in <code>result</code>.</li>
</ol>
</li>
</ol>
</li>
<li>Set the command's response value to <code>value</code>.</li>
</ol>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment