Run scripts in Chrome browser using Selenium WebDriver
// On ubuntu
// System.setProperty("webdriver.chrome.driver", "/usr/local/google/home/vindukuri/Desktop/testing1/chromedriver");
WebDriver driver = new ChromeDriver();
1. Download chromedriver.exe file
2. Set the system property by the path
3. Use ChromeDriver
3. Use ChromeDriver
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ChromeBrowserTest {
@Test
public void chromeBrowser() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "E:\\Selenium\\chromedriver_win32\\chromedriver.exe");
// On ubuntu
// System.setProperty("webdriver.chrome.driver", "/usr/local/google/home/vindukuri/Desktop/testing1/chromedriver");
WebDriver driver = new ChromeDriver();
driver.get("http://docs.seleniumhq.org/");
Thread.sleep(3000);
driver.close();
}
}
No comments:
Post a Comment