Selenium invoke JS operation scroll bar (Java) to resolve the element not clickable problem

Source: Internet
Author: User

Today, when you run an Automation use case, you find that an element always hints at not clickable. The reason for the analysis is probably the big top icon in the bottom right corner of the page, just blocking the element I want to click. To solve it, you have to pull the page, you need to manipulate the scroll bar on the page.

A relatively simple method is used, which is documented here:

    

Javascriptexecutor js= (javascriptexecutor) driver;
String high= "Scroll (0,10000);"; /scroll to the Y value of 10000 pixels, general 10000 to the bottom of the page, you can debug according to your needs
Js.executescript (high);

Selenium invoke JS operation scroll bar (Java) to resolve the element not clickable problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.