I would like to ask you how can I scroll into a web page by using a JS command. Though, I want this JS command inside a Java code-block. For the above purpose let me tell you that I also use Selenium framework. Is it possible?
The purpose is to do so by using Selenium and Java. I don't care about the general usage of JavascriptExecutor. I want their combination for SCROLL functionality!
If I understand you correctly you are trying to scroll the page inside your selenium code. You can try something like this.
WebDriver driver = new ChromeDriver();
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.scrollBy(0,1000)"); //Scroll vertically down by 1000 pixels
Let us know how this works for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With