How To Launch a Chrome Browser in Selenium?

Timothy Joseph Timothy Joseph | June 14, 2021

How to Launch a Chrome Browser in Selenium?

To invoke/open browsers using automated tools and run tests on them, browser vendors have exposed their browser API which can be used by the Selenium WebDriver interface. Almost all the major browsers have their browser-specific driver classes that implement this interface like ChromeDriver, IEDriver, FirefoxDriver, SafariDriver, etc.

We need to download the drivers into our system.

Before calling browser, we must set system property specific to the browser For example, For Chrome browse we need to set below property

System.setProperty("", "local path to chromedriver exe file");

//Invoking chrome driver in your suite

WebDriver driver = new ChromeDriver()

We can follow same steps for other browsers like Firefox, IE/Edge and Safari browsers. We just need to download their respective drivers and set the property for them and call them like

WebDriver driver = new browserDriver();

Note: Replace browserDriver with the browser for which we had set the property and want to invoke for our testing purpose.


This publication is for informational purposes only and nothing contained in it should be considered legal advice. We expressly disclaim any warranty or responsibility for damages arising out of this information and encourage you to consult with legal counsel regarding your specific needs. We do not undertake any duty to update previously posted materials.

Post a Comment