Google Chrome:
- Download the chromedriver.exe file based on your browser version from this link http://chromedriver.storage.googleapis.com/index.html.
- Once download completed copy the chromedriver.exe file and paste it in windows folder or you can set the environmental variables path to the location of chromedriver.exe(Ex location path like:D:\chromedriver.exe).
- Download latest selenium server jar file from this link http://docs.seleniumhq.org/download/ and then add this jar into your project build path.
- Below I have pasted my selenium code to launch the browser for your reference
import org.openqa.selenium.chrome.ChromeDriver;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver = new ChromeDriver(); // launch the browser
driver.get("http://www.google.com"); // navigate to url
}
}
InternetExplorer:
- Download the IEdriverserver.exe file based on your OS version(32bit/64bit) from this link http://docs.seleniumhq.org/download/
- Once download completed copy the IEdriverserver.exe file and paste it in windows folder or you can set the environmental variables path to the location of IEdriverserver.exe(Ex location path like:D:\IEdriverserver.exe).
- Download latest selenium server jar file from this link http://docs.seleniumhq.org/download/ and then add this jar into your project build path.
- Below I have pasted my selenium code to launch the browser for your reference
import org.openqa.selenium.ie.InternetExplorerDriver;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver = new InternetExplorerDriver(); // launch the browser
driver.get("http://www.google.com"); // navigate to url
}
}
Firefox:
- Download latest selenium server jar file from this link http://docs.seleniumhq.org/download/ and then add this jar into your project build path.Note:New selenium jar supports all version of firefox browsers so better use latest selenium server jar.
- Below I have pasted my selenium code to launch the browser for your reference
import org.openqa.selenium.firefox.FirefoxDriver;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver = new FirefoxDriver();// launch the browser
driver.get("http://www.google.com"); // navigate to url
}
}