Selenium Code
At this point Selenium setup was completed successfully now it's time to include the java selenium code into the class created previously. Please follow the steps listed below:
Step 28.- Double click on Practice1.java then replace the code with this code:
package test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Practice1
{
public static void main(String[] args)
{
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
System.out.println(driver.getTitle());
driver.close();
}
}
package test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Practice1
{
public static void main(String[] args)
{
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
System.out.println(driver.getTitle());
driver.close();
}
}