browser.get#
Functions#
dimensions(xpath, timeout=None)
#
Get width and height of element in pixels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the element. | required |
timeout | float | None | In seconds. Timeout to wait for element. If | None |
Returns:
Type | Description |
---|---|
tuple[int, int] | Width and height in pixels. |
element(xpath, timeout=None)
#
Get single WebElement
by XPath.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the element. | required |
timeout | float | None | In seconds. Timeout to wait for element. If | None |
Returns:
Type | Description |
---|---|
WebElement | Web element. |
elements(xpath, timeout=None)
#
Get multiple WebElement
s by XPath. Assumes that the XPath targets multiple elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the elements. | required |
timeout | float | None | In seconds. Timeout to wait for element. If | None |
Returns:
Type | Description |
---|---|
list[WebElement] | List of web elements of type |
elements_by_tag(tag, timeout=None)
#
"Get multiple WebElement
s by HTML tag. Assumes that the XPath targets multiple elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag | str | HTML tag of the elements. For example, | required |
timeout | float | None | In seconds. Timeout to wait for element. If | None |
Returns:
Type | Description |
---|---|
list[WebElement] | List of web elements of type |
page_title()
#
text(xpath, timeout=None)
#
Get text from element.
Note
This method assumes that the text field shouldn't be empty and therefore will retry to get the text (for better support of single-page apps with extended loading time).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the element. | required |
timeout | float | None | In seconds. Timeout to wait for element. If | None |
Returns:
Type | Description |
---|---|
str | Text from element. |
texts(xpath, timeout=None)
#
Get array of texts from elements. Assumes that the XPath targets multiple elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the elements. | required |
timeout | float | None | In seconds. Timeout to wait for elements. If | None |
Returns:
Type | Description |
---|---|
list[str] | List of texts from elements. |