browser.wait.until#
Functions#
contains_any_text(xpath, timeout=None)
#
Wait until element contains any text, e.g. an element in a single-page application that loads later than first page paint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the element. | required |
timeout | float | None | In seconds. Timeout to wait for element. If | None |
element_disappears(xpath, timeout=None)
#
Wait until element doesn't exist.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the element. | required |
timeout | float | None | In seconds. Timeout to wait for element to disappear. If | None |
images_have_loaded(xpath='//img', timeout=None)
#
Wait until the image(s) on the page have loaded.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the element. Can target one or more images. If | '//img' |
timeout | float | None | In seconds. Timeout to wait for element(s) to be loaded. If | None |
Example
As images often load after first page paint and sometimes require extra time to download, it's useful know when a specific image or all images have loaded. By default, this method targets all image elements on a page:
If you don't want to target all image elements, you can target, for instance, the first image element by specifying the XPath:
Or target all image elements with a specific class:
is_clickable(xpath, timeout=None)
#
Wait until element is clickable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the element. | required |
timeout | float | None | In seconds. Timeout to wait for element. If | None |
number_of_window_handles_is(expected_handles, timeout=None)
#
Wait until number of window handles is.
Note
Useful when working with multiple tabs or browser windows as they sometimes take time to load.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expected_handles | int | Expected number of window handles. | required |
timeout | float | None | In seconds. Timeout to wait for operation. If | None |