Browser Launch in Selenium Webdriver

There are some popular browsers available, for example, Google Chrome, Mozilla Firefox, Internet Explorer, Opera, Safari etc. In this article, we will learn the Browser Launch in Selenium Webdriver.

  • Browsers should be available in the System.
  • To Launch the Mozilla Firefox browser latest version 45 or above, Gecko Driver should be available in the system. So we can download it from below site as per the system

https://github.com/mozilla/geckodriver/releases

  • To Launch Google Chrome, the chromedriver.exe should be available. So we can download the chromedriver.exe from below site

https://sites.google.com/a/chromium.org/chromedriver/downloads

  • To Launch Internet Explorer, the Internet Explorer Driver Server should be available. So we can download the InternetExplorerDriver.exe from the below site

http://www.seleniumhq.org/download/

  • To Launch Opera or Safari browser, the Opera Driver or Safari Driver should be available. So we can download the Opera Driver.exe or Safari driver from the above site
  • Click on the latest release driver then download driver according to the system like a win32.zip file or any.
  • Extract the Zip file then copy and paste it into Library folder.

How to launch the latest version of Mozilla Firefox Browser?

public void Launch_NewFirefox()

{

System.setProperty(“webdriver.gecko.driver”, “D:\\Selenium\\Library\\geckodriver.exe”);

driver=new FirefoxDriver();

driver.get(“http://workforquality.com”);

}       

 

How to launch the Old version (Firefox V 45 or below) of Mozilla Firefox Browser?

public void Launch_OldFirefox()

{

driver=new FirefoxDriver();

driver.get(“http://workforquality.com”);

}       

        

How to launch the latest version of Google Chrome Browser?

public void Launch_Chrome()

{

System.setProperty(“webdriver.chrome.driver”, “D:\\Selenium\\Library\\chromedriver.exe”);

driver=new ChromeDriver();

driver.get(“http://workforquality.com”);

}

 

How to launch the latest version of Internet Explorer Browser?        

public void Launch_IE()

{

System.setProperty(“webdriver.InternetExplorer.driver”, “D:\\Selenium\\Library\\IEDriverServer.exe”);

driver=new InternetExplorerDriver();

driver.get(“http://workforquality.com”);

}

 

How to launch the latest version of Opera Browser?

public void Launch_Opera()

{

System.setProperty(“webdriver.opera.driver”, “D:\\Selenium\\Library\\operadriver.exe”);

driver=new OperaDriver();

driver.get(“http://workforquality.com”);

}

 

How to launch the latest version of Safari Browser?

public void Launch_Safari()

{

System.setProperty(“webdriver.safari.driver”, “D:\\Selenium\\Library\\safaridriver.exe”);

driver=new SafariDriver();

driver.get(“http://workforquality.com”);

}

 

Please click here to read Selenium Webdriver features

Please click here to read Locators in Selenium Webdriver

2 Thoughts on Browser Launch in Selenium Webdriver

Leave a Comment