Working with Different browsers in Selenium WebDriver
Selenium WebDriver supports different types of browsers by using its native as well as third party web drivers. Firefox browser is natively supported in Selenium Web driver, but for all other browsers, third party web driver are available for Selenium.
Selenium Supported browsers
Selenium supports different types of browsers, such as
Here are the code snippets for Firefox, Chrome and IE
System.setProperty("webdriver.firefox.bin","F:\\Program Files (x86)\\Firefox\\Firefox.exe");
WebDriver driver = new FirefoxDriver();
WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver();
Checkout the complete video from here
Please leave your comments and thanks for watching and reading the post !!!
9 Replies to “Working with Different browsers in Selenium WebDriver”
Nice and very granular level of explaination and a great one for beginers in selenium
Thanks for the video. It is really helpful.
Following could be useful for the users
1. Install opera browser latest version
2. Download and extract the opera driver to the lib directory as in the video
3. Add the lib directory to the PATH
4. Code snippet for Opera
WebDriver driver = new OperaDriver();
Note :: You can skip setting the System property when the driver is added to the PATH
1. Install the Safari web browser
2. Download safari driver latest version from Selenium download page
3. Click on the downloaded file to install the driver on the browser
4. Following code snippet can be used
WebDriver driver = new SafariDriver();
Code snippet for HTMLUnitDriver
WebDriver driver = new HTMLUnitDriver();
Thanks for the information Janesh, this will be helpful for the community !!!
Do we need to set property for HTmlUnitdriver?. IF so, please let me know. could you elaborate you blog for HtmlUntidriver
PhanthomJS is another headless browser like HTMLUnitDriver
Steps to run PhanthomJS with Selenium WebDriver.
1. Download Phanthom JS
2. Download the phantomjsdriver-1.1.0.jar from
3. Add the jar file into the classpath
4. Code snippet
File file = new File(“E:\\PTL\\selenium\\June2015\\OrangeHRM\\install\\drivers\\phantomjs.exe”);
WebDriver driver = new PhantomJSDriver();
Thank you Janesh for sharing your knowledge with community, this will help !!!
Firefox driver is not supported by WebDriver now.
Will you be updating the videos to reflect recent changes in WebDriver 3.x?
Your Videos are really helpful to the community.
Thanks for your comment, but its actually covered in another video here https://www.youtube.com/watch?v=VEEmVb1W3jA
Thanks for quick response.