In the UI Automation-Selenium, it is difficult to maintain the webdrivers updated with the browser updates.
Browsers like Chrome, Firefox, IE, Safari, Mac Chrome and Mac Firefox should have compatible webdrivers before the start of the Automation execution or the development.
Most of the clients, requests to run the regression or Functional set on the latest browsers.
Downloading the webdrivers manually and store it in the desired location is a time-consuming activity and failure to update driver eventually causes the failure and delays the execution.
We adopted the solution of managing the binary webdrivers (e.g. chromedriver, geckodriver, IEDriverServer, msedgedriver) required by Selenium webdriver using the webdrivermanager.
<webdrivermanager.version>3.3.0</webdrivermanager.version>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>${webdrivermanager.version}</version>
<scope>compile</scope>
</dependency>
Initialization:
import io.github.bonigarcia.wdm.WebDriverManager;
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR,UnexpectedAlertBehaviour.IGNORE);
setDriver(new RemoteWebDriver(new URL(Node), options));