browser.check_if#
Functions#
contains_any_text(xpath) #
Check if element contains any text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
1 2 | |
contains_text(xpath, regex, ignore_case=True) #
Check if element contains text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
regex | str | Regular expression or text to search for. The condition works for both ordinary text (e.g. | required |
ignore_case | bool | Ignore case when searching for text. | True |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
Without regular expression:
1 2 | |
With regular expression:
1 2 | |
does_exist(xpath) #
Check if element exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
1 2 | |
is_clickable(xpath) #
Check if element is clickable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
1 2 3 4 | |
is_disabled(xpath) #
Check if element is disabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
1 2 | |
is_displayed(xpath) #
Check visibility status of an element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
1 2 | |
is_enabled(xpath) #
Check if element is enabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
1 2 | |
is_image_loaded(xpath) #
Check is image is loaded and ready in the DOM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
1 2 3 | |
is_in_viewport(xpath) #
Check if an element is visible in the current viewport.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
1 2 3 | |
is_selected(xpath) #
Check if element is selected, e.g. checkbox or radio button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xpath | str | XPath of the element. | required |
Returns:
| Type | Description |
|---|---|
bool |
|
Example
1 2 3 | |