Launch Chrome & Firefox Browsers using Selenium WebDriver - H Y R Tutorials

Launch Chrome & Firefox Browsers using Selenium WebDriver

Share This
hyrtutorials
In this video, I have explained how we can launch chrome and firefox browsers using selenium WebDriver and after watching this you can launch any other browser also in the way I have shown in the video.
Selenium WebDriver is an open-source tool for automated testing of web apps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. ChromeDriver: ChromeDriver is a standalone server that implements the W3C WebDriver standard. ChromeDriver is available for Chrome on Android and Chrome on Desktop (Mac, Linux, Windows and ChromeOS) ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome. It is maintained by the Chromium team with help from WebDriver contributors. Follow these steps to set up your tests for running with ChromeDriver:
  • Ensure Chromium/Google Chrome is installed in a recognized location
  • ChromeDriver expects you to have Chrome installed in the default location for your platform. You can also force ChromeDriver to use a custom location by setting a special capability.
  • Download the ChromeDriver binary for your platform under the downloads section of https://chromedriver.chromium.org/ site and Help WebDriver find the downloaded ChromeDriver executable by specifying its location via the webdriver.chrome.driver system property (see sample below)
Sample Code:
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");WebDriver driver = new ChromeDriver();
GeckoDriver: geckodriver is an implementation of WebDriver, and WebDriver can be used for widely different purposes. How you invoke geckodriver largely depends on your use case. If you are using geckodriver through Selenium, you must ensure that you have version 3.11 or greater. Because geckodriver implements the W3C WebDriver standard and not the same Selenium wire protocol older drivers are using, you may experience incompatibilities and migration problems when making the switch from FirefoxDriver to geckodriver. Generally speaking, Selenium 3 enabled geckodriver as the default WebDriver implementation for Firefox. With the release of Firefox 47, FirefoxDriver had to be discontinued for its lack of support for the new multi-processing architecture in Gecko. Selenium client bindings will pick up the geckodriver binary executable from your system’s PATH environmental variable unless you override it by setting the webdriver.gecko.driver Java VM system property Sample Code:
System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver");WebDriver driver = new FirefoxDriver();