Information about web elements
There are a number of details you can query about a specific element.
Is Displayed
This method is used to check if the connected Element is
displayed on a webpage. Returns a Boolean
value,
True if the connected element is displayed in the current
browsing context else returns false.
This functionality is mentioned in, but not defined by the w3c specification due to the impossibility of covering all potential conditions. As such, Selenium cannot expect drivers to implement this functionality directly, and now relies on executing a large JavaScript function directly. This function makes many approximations about an element’s nature and relationship in the tree to return a value.
Is Enabled
This method is used to check if the connected Element is enabled or disabled on a webpage. Returns a boolean value, True if the connected element is enabled in the current browsing context else returns false.
Is Selected
This method determines if the referenced Element is Selected or not. This method is widely used on Check boxes, radio buttons, input elements, and option elements.
Returns a boolean value, True if referenced element is selected in the current browsing context else returns false.
Tag Name
It is used to fetch the TagName of the referenced Element which has the focus in the current browsing context.
Size and Position
It is used to fetch the dimensions and coordinates of the referenced element.
The fetched data body contain the following details:
- X-axis position from the top-left corner of the element
- y-axis position from the top-left corner of the element
- Height of the element
- Width of the element
Get CSS Value
Retrieves the value of specified computed style property of an element in the current browsing context.
Text Content
Retrieves the rendered text of the specified element.
Fetching Attributes or Properties
Fetches the run time value associated with a DOM attribute. It returns the data associated with the DOM attribute or property of the element.