Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to scroll down chrome browser in selenium java

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;

public class ScrollByVisibleElement {

    WebDriver driver;
    @Test
    public void ByVisibleElement() {
        System.setProperty("webdriver.chrome.driver", "G://chromedriver.exe");
        driver = new ChromeDriver();
        JavascriptExecutor js = (JavascriptExecutor) driver;

        //Launch the application		
        driver.get("http://demo.guru99.com/test/guru99home/");

        //Find element by link text and store in variable "Element"        		
        WebElement Element = driver.findElement(By.linkText("Linux"));

        //This will scroll the page till the element is found		
        js.executeScript("arguments[0].scrollIntoView();", Element);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: getcokor from drawable in java android studio 
Java :: Which package contains the Math classin java? 
Java :: sendPlanUpgrade 
Java :: what is minecraft default render distance 
Java :: random number in java between 10 and 20 
Java :: Draw an item using System.out.println 
Java :: java formatted string input 
Java :: how to add element in java arraylit syntax in gfg 
Java :: java multiple implements 
Java :: java optional input for funktions 
Java :: break statement in Java switch...case 
Java :: When different programmers write the same program in differing ways and all get the correct result. what is that known as? 
Java :: arraylistof objects 
Java :: how to add a command to a button java 
Java :: system.out.println(h [2] [1] [1] [0]); 
Java :: java object array initialization 
Java :: system.out.print 
Java :: how to get map with string as key and Arraylist as value in java 
Java :: Java Super Power java 
Java :: java get parent process name 
Java :: contoh object dalam oop java 
Java :: final variables in java 
Java :: throw keyword in java 
Java :: java lambda function 
Java :: what is operator overloading in java 
Java :: java deserialize json object 
Java :: extract substring in string java 
Java :: java read all text from file 
Java :: why cant we have primitive types in generixs 
Sql :: sql disable safe mode 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =