How to scroll an element into view in Selenium

Опубликовано: 16 Март 2021
на канале: automateNow
3,178
29

Learn how to scroll an element into view (visible area of the browser window) in Selenium WebDriver.

** UPDATE **
Selenium 4 offers an easier way to scroll a web page without the use of JavascriptExecutor!
https://www.selenium.dev/documentatio...

Although Selenium WebDriver does not have a method that we can use to scroll a given element into view, we can use its JavascriptExecutor interface along with the HTML DOM's scrollIntoView method to execute some JavaScript code that will do just that. This video will show you how it is done.

Can you think of some reasons why we may want to scroll an element into view when using Selenium WebDriver? Please leave your comments below!

You can find the source code for this project on automateNow's GitHub page.
https://github.com/automatenow/IntroT...

😀 Subscribe for weekly videos! 👍

📑 CHAPTERS

0:00 ~ Intro
0:15 ~ Scenario description
0:37 ~ Writing the test
1:53 ~ Using JavascriptExecutor interface
4:17 ~ Running the test
4:44 ~ Setting the scrolling alignment

👩‍🎓 COURSES

☕ Java For Absolute Beginners https://bit.ly/learn-java2022

⏯ PLAYLISTS

☑️ Automation Fundamentals https://bit.ly/2QbN7qm
☑️ Automation Tools https://bit.ly/2OFj4qO
☑️ General WebDriver https://bit.ly/2Z3tG7y
☑️ Intro to WebDriver https://bit.ly/3gb5Jlx
☑️ Intermediate WebDriver https://bit.ly/2OBTR0r
☑️ Java https://bit.ly/3sBuI7M
☑️ Selenium 4 https://bit.ly/2VQ1lA9
☑️ Version Control https://bit.ly/3CvHplU
☑️ Web Element Locators https://bit.ly/2QfDGpK

📫 LET'S CONNECT!

☑️ https://linktr.ee/automateNow

🔗 REFERENCES

☑️ W3Schools https://bit.ly/3s66bUr
☑️ W3Schools https://bit.ly/321RdUK


Смотрите видео How to scroll an element into view in Selenium онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь automateNow 16 Март 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,178 раз и оно понравилось 29 людям.