Rayrun
← Back to videos

Playwright - How to control scrollbar

Practice Test Automation: https://commitquality.com

In this video, the host demonstrates how to interact with the scroll bar on a web page using the Playwright library. The video starts with a brief introduction and then jumps into the code implementation.

The host begins by adding a page.pause command, which pauses the execution of the script, allowing the viewer to see the actions in real-time. They then use the page.evaluate method to access the window object and utilize the scrollBy method to scroll the page.

Initially, they scroll down by 10 pixels, which results in a small movement of the scroll bar. They demonstrate this by running the code using the Playwright test command.

Next, the host increases the scroll distance to 100 pixels and reruns the code, showing a larger movement of the scroll bar. This highlights the flexibility of scrolling options and the ability to manually scroll the page.

In the next section, the host demonstrates how to scroll to a specific element on a page. They use the page.locator method to select an element by its data-test-id attribute. By using the scrollIntoViewIfNeeded method on the selected element, they scroll the page to make the element visible.

The host concludes the video by mentioning that they plan to create a follow-up video on scrolling within scrollable elements. They express their willingness to answer any questions or address any comments from viewers, and encourage likes and subscriptions to support their work. They also mention the option for viewers to use "super thanks" to make donations towards creating future videos.

Overall, this video provides a quick and informative tutorial on interacting with the scroll bar on a web page using Playwright.

Related Videos

#16 - ARIA and how Playwright is making use of it to identify UI controls?
#16 - ARIA and how Playwright is making use of it to identify UI controls?
How to Code a Test Automation on Youtube | Playwright JS
How to Code a Test Automation on Youtube | Playwright JS
Create feature, steps & config | Playwright & Cucumber - Typescript | Part 1
Create feature, steps & config | Playwright & Cucumber - Typescript | Part 1
Working with multiple elements in Playwright Test (NodeJS)
Working with multiple elements in Playwright Test (NodeJS)
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.