diff --git a/09_elements.html b/09_elements.html --- a/09_elements.html +++ b/09_elements.html @@ -95,9 +95,54 @@

XPath

Strategy name: xpath

All WebDriver implementations MUST support finding elements by XPath 1.0 [[!XPATH]] with the edits from section 3.3 of the [[!html51]] specification made. If no native support is present in the browser, a pure JS implementation MAY be used. When called, the returned values MUST be equivalent of calling "evaluate" function from [[DOM-LEVEL-3-XPATH]] with the result type set to "ORDERED_NODE_SNAPSHOT_TYPE (7).

+ +
+

Element Visibility

+ +

The element visibility is determined by applying the following steps on an element:

+ + + +

Essentially, this attempts to model whether or not a user of the browser could possibly find a way to view the WebElement without resizing the browser window. + +

+

The common usage pattern for isDisplayed is typically something similar to (in python):

+
+        element = driver.find_element(by = TAG_NAME, value= = "button")
+        if element.is_displayed():
+            element.click()
+        else
+            # So other deep magic of the unseen ages.
+      
+
+ +

If the steps above return true, then the element MUST also be interactable should it meet the other criteria for being interactable. If any part of the BODY can be brought into the current viewport, the return value MUST be true. + +

This implies that isDisplayed 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 displayed 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 low level commands. 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.

+
diff --git a/10_element_state.html b/10_element_state.html --- a/10_element_state.html +++ b/10_element_state.html @@ -9,74 +9,50 @@
The y coordinate for the top left of the element
double height
Height of the element in CSS reference pixels
double width
Width of the element in CSS reference pixels
boolean isDisplayed()
-

+

- +
HTTP Method Path Template Notes
GET/session/{sessionId}/element/{ELEMENT}/displayed/session/{sessionId}/element/{element}/displayed
-

Determining if an element is displayed

-

The following steps MUST be used to determine if an element is displayed to a user.

- -

- Essentially, this attempts to model whether or not a user of the browser could possibly find a way to view the WebElement without resizing the browser window. -

-
-

- The common usage pattern for isDisplayed is typically something similar to (in python):

-
-              element = driver.find_element(by = TAG_NAME, value= = "button")
-              if element.is_displayed():
-                  element.click()
-              else
-                  # So other deep magic of the unseen ages.
-            
-
-

If isDisplayed returns true, then the element MUST also be - interactable 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. -

-

This implies that isDisplayed 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 displayed 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 low level commands. 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.

-
-

If the ELEMENT does not represent a Document element, or it represents a Document element that is no longer attached to the document's node tree, then the WebDriver implementation MUST immediately abort the command and return a stale element reference error. If the top level browsing context currently receiving commands is no longer open a no such window error MUST be raised. +

The command is used to determine the element visibility of the Document element connected with the web element reference given by the element fragment in the path.

+ +

The response is composed using the following algorithm:

+ +
    +
  1. Let response be an initially empty response.
  2. +
  3. Let visible be a boolean initially set to false.
  4. +
  5. Let element be an initially undefined Document element.
  6. +
  7. Let element reference be a string with the value of the element fragment from the path.
  8. +
  9. If element reference is null or has a length equal to 0, set response's status to the invalid argument status and return response.
  10. +
  11. If the default content's top level browsing context is no longer open, set response's status to the no such window status and return response.
  12. +
  13. Set element be the Document element found after applying the web element lookup algorithm to the element reference map.
  14. +
  15. If element is null or element does not represent a Document element, set response's status to the no such element status and return response.
  16. +
  17. If element represents Document element that is no longer attached to the document's node tree, set response's status to the stale element reference status and return response.
  18. +
  19. Apply the element visibility algorithm to element and set visible to its return value.
  20. +
  21. Set response's status to success and its value to visible.
  22. +
  23. Return response.
  24. +
+
boolean isSelected()

HTTP Method Path Template Notes