Answers for "javascript code for scroll down up to end of in web page"

1

scrolling in selenium

Selenium does not have a method for scrolling
 but there are some ways to scroll:
 
   #1 ->=moveToElement= coming from Actions class
   will scroll down and up to given web element
   #2 Using JSExecutor: We can inject JavaScript
   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.
==================================================   
   
  syntax is =   
   JavaScriptExecutor js = (JavaScriptExecutor) Driver.getDriver();
   js.executeScript("in here we need to pass js code that scrolls");
    
  
     js.executeScript("window.scrollBy(0,250)");
     js.executeScript("arguments[0].scrollIntoView(true);", WebElement);
Posted by: Guest on December-04-2020

Code answers related to "javascript code for scroll down up to end of in web page"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language