Previous Topic,Running Test Case in Chrome Browser is simple as running in the other browser, difference is we need to provide the chrome driver on the path.
Running Test Case in Chrome Browser?
To Run the Test on chrome Browser follow the below steps one by one.
Step 1) Click to Click Here link to open the latest chrome driver installation version and click on chrome driver as per the chrome version on your system
Step 2) Click on the chrome driver link as per configuration of OS on you system. Lets say i have window OS so in that click click to chromedriver_win32.zip.
Step3) Now download the Zip to any of you preferred location and unzip it.
Step 4) Open the eclipse and create a class and copy the below code.
Cope the below code:
package SeleniumArchitecture;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class FiestTestScriptChrome {
public static void main(String[] args) throws InterruptedException {
//System property of the Chrome driver( provide the local path of chrome driver here)
System.setProperty("webdriver.chrome.driver",
"C:\\Users\\xxxx\\Desktop\\Eclipse_Installer\\GeckoDriver\\chromedriver.exe");
// Create oject of chrome driver
WebDriver driver = new ChromeDriver();
// Open facebook page
driver.get("http://www.facebook.com");
//Maximise the window
driver.manage().window().maximize();
//Wait for 5 sec
Thread.sleep(5000);
//Quit driver instance
driver.quit();
}}
Step5) Now Run the below code, Right click to java file ->Run as->Java application