Cilvet
0
Q:

scrolling

 Selenium does not have a dedicated method specifically for scrolling 
 in the page but there are some ways to scroll for example =
 
   #1 ->=moveToElement= coming from Actions class will scroll down and up to 
   given web element
   Scrolling using JSExecutor: We can inject JavaScrip code in our Java+Selenium 
   code using JSExecutor which helps us scroll up, down, left, right.
   We need to create instance of JS executor, then cast our driver type of it.
   JavaScriptExecutor js = (JavaScriptExecutor) Driver.getDriver();
   js.executeScript("in here we need to pass js code that scrolls");
    
    syntax is =
    #2- js.executeScript("window.scrollBy(0,250)");
    #3- js.executeScript("arguments[0].scrollIntoView(true);", WebElement);
1

New to Communities?

Join the community