Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » Selenium » Solved Programs » Launch browser in Selenium

How to launch browser in Selenium Automation

//you can create any package
package com.selenium.test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class LaunchBrowser {

public static void main(String[] args) {

//System.setProperty("webdriver.ie.driver","driver C:\\Users\\axa1545\\Desktop\\SeleniumLessons\\IEDriverServer.exe");
//dont need above line if driver.exe is in same project folder

WebDriver driver = new FirefoxDriver();

//Launch Chrome browser
//WebDriver driver1 = new ChromeDriver();

//Launch IE browser
//WebDriver driver2 = new InternetExplorerDriver();		

//Enter any URL

//Close the driver after use