This allows you to run UI tests using selenium webdriver. You can also run your tests in parallel by specifying the number of parallel threads as -DthreadCount= as runtime param.
- Java 11
- Maven >3.0
- You can build the project with maven goals
clean install
In order to include selenium-java-framework in your Maven project, first add the following dependency to your pom.xml:
<dependency>
<groupId>io.github.nsingla</groupId>
<artifactId>selenium-framework</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>And also add following repository to your pom:
<repositories>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</repositories>Simply extend your test class with SeleniumBase.java
import io.nsingla.selenium.SeleniumBase;
/**
* This will enable your tests to fetch a webdriver object
*/
class YourTestClass extends SeleniumBase {
}| Param | Values | Default |
|---|---|---|
| mode | LOCAL, REMOTE | LOCAL |
| browser | chrome, firefox, ie, edge, safari |
chrome |
| headless | true, false | false |
| gridHost | String | localhost |
| gridPort | String | 4444 |
| consoleloglevel | OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL |
OFF |
| locale | en, es ... | en |
| downloadPath | String | null |
| retryCount | String | 0 |
| threadCount | String | 1 |
mode- To run tests locally or via gridbrowser- To specify which browser to run tests inheadless- To run tests in a headless mode or via a GUIgridHost- Selenium Grid hostnamegridPort- Selenium Grid Port Numberconsoleloglevel- Log Level for logginglocale- to set browser locale (in case website picks it based on your location)downloadPath- To specify a custom download pathretryCount- Number of times a test should retry if failed (find how to enable your tests to rerun on failure here)threadCount- To specify how many tests you want to run in parallel (total across whole suite of classes)