Extending our capabilities by using a Selenium-Grid
Since we already have a working Maven implementation, let's enhance it so that it can connect to Selenium-Grid. These enhancements will enable you to connect to any Selenium-Grid, but we are going to specifically look at connecting to a third-party service provided by SauceLabs, since they offer a free tier. Let's have a look at the modifications we need to make to our TestNG code.
We will start off with the modifications to our POM; initially, we are going to add some properties that we can configure on the command line by using this code:
<properties> <project.build.sourceEncoding>UTF- 8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF- 8</project.reporting.outputEncoding> <!-- Dependency versions --> <phantomjsdriver.version>1.4.3</phantomjsdriver.version> <selenium.version>3.5.3</selenium.version> <testng.version...