In this tutorial, I will give a small explanation about the Chrome Web Driver, Through which we will load the webpage in chrome browser.
Before starting with programming you need to download the chrome driver. Driver file you will get it from the selenium official website ( http://www.seleniumhq.org/ ).
Following source code is use to launch the browser page using chrome driver.
SeleniumDemo.java
To run and execute the code in Eclipse IDE, you need to follow the below step:
Eclipse IDE Console Tab :
Then it will launch the chrome browser and load the page.
Let us know if you have any suggestion and query.
Before starting with programming you need to download the chrome driver. Driver file you will get it from the selenium official website ( http://www.seleniumhq.org/ ).
Following source code is use to launch the browser page using chrome driver.
SeleniumDemo.java
package demo; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class SeleniumDemo { // variable name public static WebDriver driver; public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Launching the chrome driver "); // Set the chrome driver exe file path System.setProperty("webdriver.chrome.driver", "D:\\selenium_sumit\\chromedriver_win32\\chromedriver.exe"); // Instantiate the chrome driver driver = new ChromeDriver(); // set the browser URL in get() to load the webpage driver.get("https://www.google.com"); System.exit(0); } }
To run and execute the code in Eclipse IDE, you need to follow the below step:
- On Eclipse's menu bar, click Run > Run.
Eclipse IDE Console Tab :
Then it will launch the chrome browser and load the page.
No comments:
Post a Comment