SCROLL_TYPE
Definition of SCROLL_TYPE
SCROLL_TYPE
specifies how an automated test should scroll the page to ensure that a web element is within the desired view before interaction. Each type targets a different scrolling behavior:
SCROLL_TO_ELEMENT_CENTER
Definition: Scrolls the page until the specified element is at the center of the viewport.
Use Case: Use this when an element needs to be centered for visibility or for actions that require the element to be in the middle of the screen, such as taking screenshots or ensuring visibility for complex interactions.
SCROLL_TO_BOTTOM
Definition: Scrolls the page all the way to the bottom.
Use Case: Essential when you need to interact with elements that are located at the bottom of the page or to ensure that lazy-loaded elements are triggered and loaded.
SCROLL_TO_TOP
Definition: Scrolls the page to the top.
Use Case: Useful for resetting the view to the top of the page before beginning a sequence of actions, or when top navigation elements need to be accessed.
NONE
Definition: Indicates that no scrolling action should be taken.
Use Case: Selected when the desired element is already in view, or when scrolling is managed by other means within the test.
Choosing the Right SCROLL_TYPE
The correct
SCROLL_TYPE
ensures that web elements are interacted with as a user would naturally do.It can prevent issues such as attempting to click an element that is not in view, which would result in a failed test.
DEMO
Last updated
Was this helpful?