Selenium driver class – WebDriver versus RemoteWebDriver
In the first chapter, the CreateDriver.java Selenium driver class was built. The class has several setDriver methods that take the parameters passed into the suite for the browser, mobile device, platform, and environment, and process them when creating the driver instance.
Now, when running on a remote environment, we need to add several conditions to the setDriver methods to pass the desired capabilities and preferences to the RemoteWebDriver class, instead of the local WebDriver instance.
Let's look at these conditions for each setDriver method in this class.
The setDriver method for browser
In the main setDriver method, we had first set up a series of switch cases for each browser and mobile type. In those cases, we set the browser/mobile preferences and desired capabilities. Once that was done, we cast them to the local WebDriver and it was launched.
Now, we need to check and see if the user passed in the environment parameter as ...