browser.scroll#
Functions#
by(x, y, delay_seconds=1)
#
If possible, scroll by X and Y pixels as relative to current position.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x | int | In pixels. Scroll on horisontal X axis as relative to current position. Can be positive or negative. | required |
y | int | In pixels. Scroll on vertical Y axis as relative to current position. Can be positive or negative. | required |
delay_seconds | float | Option to add custom delay in seconds to ensure the view is updated after scroll. | 1 |
down_by(pixels, delay_seconds=1)
#
If possible, scroll down by Y pixels. Horisontal position is unchanged.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pixels | int | Amount to scroll down as relative to current position. | required |
delay_seconds | float | Option to add custom delay in seconds to ensure the view is updated after scroll. | 1 |
into_view(xpath, timeout=None, delay_seconds=1)
#
Find element and scroll up or down until element is visible.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the element. | required |
timeout | float | None | In seconds. Timeout to wait for element. If | None |
delay_seconds | float | Option to add custom delay in seconds to ensure the view is updated after scroll. | 1 |
into_view_if_not_in_viewport(xpath, timeout=None, delay_seconds=1)
#
If not visible in the current viewport, find element and scroll up or down until element is visible.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xpath | str | XPath of the element. | required |
timeout | float | None | In seconds. Timeout to wait for element. If | None |
delay_seconds | float | Option to add custom delay in seconds to ensure the view is updated after scroll. | 1 |
left_by(pixels, delay_seconds=1)
#
If possible, scroll left by X pixels. Horisontal position is unchanged.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pixels | int | Amount to scroll left as relative to current position. | required |
delay_seconds | float | Option to add custom delay in seconds to ensure the view is updated after scroll. | 1 |
right_by(pixels, delay_seconds=1)
#
If possible, scroll right by X pixels. Horisontal position is unchanged.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pixels | int | Amount to scroll right as relative to current position. | required |
delay_seconds | float | Option to add custom delay in seconds to ensure the view is updated after scroll. | 1 |
to_position(x, y, delay_seconds=1)
#
If possible, scroll to coordinate X and Y pixels of page as absolute position.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x | int | Absolute position in pixels on horisontal X axis. | required |
y | int | Absolute position in pixels on vertical Y axis. | required |
delay_seconds | float | Option to add custom delay in seconds to ensure the view is updated after scroll. | 1 |
up_by(pixels, delay_seconds=1)
#
If possible, scroll up by Y pixels. Horisontal position is unchanged.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pixels | int | Amount to scroll up as relative to current position. | required |
delay_seconds | float | Option to add custom delay in seconds to ensure the view is updated after scroll. | 1 |