NullPointerException in Selenium WebDriver - java

I'm a beginner Selenium practitioner. I have 2 classes, one for the WebDriver another is for Log In. I followed some youtube tutorials but can't pinpoint what I'm doing wrong. I tried the concept of 'Baseclass' where I extend the other class.
LogIn Class
WebDriver Class
If I add the WebDriver in the other class, it will run successfully. But I want to make it more 'organized'
this is the error
Error message

public Webdriver driver;
Please add static in this line
public static Webdriver driver;
because you need use same driver instance for all classes
create above line in top of both classes

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
public class TestApp {
private WebDriver driver;
private static TestApp myObj;
// public static WebDriver driver;
utils.PropertyFileReader property = new PropertyFileReader();
public static TestApp getInstance() {
if (myObj == null) {
myObj = new TestApp();
return myObj;
} else {
return myObj;
}
}
//get the selenium driver
public WebDriver getDriver()
{
return driver;
}
//when selenium opens the browsers it will automatically set the web driver
private void setDriver(WebDriver driver) {
this.driver = driver;
}
public static void setMyObj(TestApp myObj) {
TestApp.myObj = myObj;
}
public void openBrowser() {
//String chromeDriverPath = property.getProperty("config", "chrome.driver.path");
//String chromeDriverPath = property.getProperty("config", getChromeDriverFilePath());
System.setProperty("webdriver.chrome.driver", getChromeDriverFilePath());
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
options.addArguments("disable-infobars");
driver = new ChromeDriver(options);
driver.manage().window().maximize();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void navigateToURL() {
String url =property.getProperty("config","url");
;
driver.get(url);
}
public void closeBrowser()
{
driver.quit();
}
public WebElement waitForElement(By locator, int timeout)
{
WebElement element = new WebDriverWait(TestApp.getInstance().getDriver(), timeout).until
(ExpectedConditions.presenceOfElementLocated(locator));
return element;
}
private String getChromeDriverFilePath()
{
// checking resources file for chrome driver in side main resources
URL res = getClass().getClassLoader().getResource("chromedriver.exe");
File file = null;
try {
file = Paths.get(res.toURI()).toFile();
} catch (URISyntaxException e) {
e.printStackTrace();
}
return file.getAbsolutePath();
}
}
//create package name called utils and under that package create class name with TestApp and paste above code
if you want use driver anywhere in your project
TestApp.getInstance().getdriver();

You didn't initialize your driver anywhere.
You need to use a before
#BeforeClass
public void setupClass(){
driver = new Chromedriver();
}
and in opensite
public static WebDriver driver;

You want your OpenSite class to act as the base class which you can extend it to your test class to intialize your driver. Remove your "#test" annotaion from the OpenSite class.
Add static with "public WebDriver driver";
Create a method openBrowser(already there) or driverInitialization in this class.
Return the driver instance.
Updated code will look like
public class OpenSite{
public static WebDriver driver;
public static void openBrowser(){
System.setProperty("webdriver","path");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("your URL");
return driver;
}
}
And in test class LogIn extend this class and call this method:
public class LogIn extends OpenSite{
#BeforeTest
public void driver initialization(){
openBrowser();
}
#Test
public void logInVendor(){
//Write your code here
}
}

Related

How to resolve Null pointer exception while invoke the driver instance fron one class to another class using Dependency injection with cucumber

I am using Dependency injection technique to invoke the driver in my step definition class,
In the first class, I have initialized the chrome driver and set it to the DI class.
But while running the code, it's not sharing to my next step Definition Class.
Created a driver in the DIClass and then initiated the chrome driver in the login class.
and then set the chrome driver object to the DIClass driver but while reaching second step definition class, I am getting null pointer error on hamburger method.
DIClass:
public class DIClass {
public WebDriver driver;
public WebDriver getDriver() {
return driver;
}
public void setDriver(WebDriver driver) {
this.driver = driver;
}
StepDefinition class:
public class LoginPage extends DIClass{
DIClass base;
public LoginPage(DIClass testContextUI) {
this.base = testContextUI;
}
#Given("I open a {string} browser")
public void i_open_a_browser(String browser) {
// System.setProperty("webdriver.chrome.driver", "/Users/vinoth/eclipse-workspace/yocoBoardI/chromedriver");
// WebDriver driver = new ChromeDriver();
// base.signIn = PageFactory.initElements(base.driver, SignIn.class);
}
#Given("I navigate to url {string}")
public void i_navigate_to_url(String url) {
System.setProperty("webdriver.chrome.driver", "/Users/vinoth/eclipse-workspace/yocoBoardI/chromedriver");
WebDriver driver = new ChromeDriver();
base.setDriver(driver);
base.signIn = PageFactory.initElements(base.driver, SignIn.class);
base.driver.get(url);
}
#When("user login into application with {string} and {string}")
public void user_login_into_application_with_and(String string, String string2) {
base.signIn.normalSignIn(string, string2);
}
#Then("I navigated to Hours page")
public void i_navigated_to_Hours_page() throws InterruptedException {
base.hoursPage = PageFactory.initElements(base.driver, HoursPage.class);
base.hoursPage.validateHOursPage();
// base.pages = PageFactory.initElements(base.driver, LeftSideBar.class);
// base.pages.clockInOut();
// base.driver.quit();
}
}
2nd Class:
public class ProfileSettings {
// WebDriver driver;
DIClass base;
LoginPage loginPage;
public ProfileSettings(DIClass testContextUI) {
this.base = testContextUI;
}
#Given("User should see the hamburger icon")
public void user_should_see_the_hamburger_icon() {
// base.setDriver(driver);
base.profileSettings = PageFactory.initElements(base.driver, ProfileSettingsPage.class);
base.profileSettings.hamburgerIcon(); - here i am getting the error .
}
#When("I clicks the profile settings label")
public void i_clicks_the_profile_settings_label() {
base.profileSettings.openFooterPopup();
}
#Then("landed to the respective page.")
public void landed_to_the_respective_page() {
base.profileSettings.validateProfileSettingsPage();
}
#When("I upload Invalid {string} formats")
public void i_upload_Invalid_formats(String string) {
//StringSelection is a class that can be used for copy and paste operations.
StringSelection stringSelection = new StringSelection(string);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
base.profileSettings.fileUpload("Mac");
}
#Then("Should see the respective voice message")
public void should_see_the_respective_voice_message() {
base.profileSettings.fileUploadValidation();
}
import depenencyInjection.DIClass;
import io.cucumber.java.After;
import io.cucumber.java.Before;
import org.junit.BeforeClass;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class DriverClass extends DIClass {
DIClass base;
public DriverClass(DIClass testContextUI) {
this.base = testContextUI;
}
#Before
public void testStep()
{
if(base.getDriver() ==null) {
System.out.println("Test Environment Setup");
System.setProperty("webdriver.chrome.driver", "Filepath");
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
base.driver = new ChromeDriver(options);
base.driver.navigate().to("https:********");
}
}
}

tearDown is not being initialised

I have a Java Automation script. I have a set up method that works but my tearDown isn't being read for some reason.
When I run my Automation test I seem to have two problems
If it fails the test run multiple times and the browser window stays open.
even if a test passed the browser window never closes, which makes things really messy.
I haven't added any feature files of code for the actual test as I think the issue is in the set up but more than happy to.
I suspect both issues are linked but I can't fathom where or how.
Here is my SeleniumSetUp Class
public class SeleniumSetup {
protected WebDriver driver;
public SeleniumSetup(WebDriver driver)
{
}
public SeleniumSetup() {
}
public void prepareBrowserForSelenium() {
// setup();
if(DriverSingleton.getDriver() == null)
{
setup();
}
else
{
driver = DriverSingleton.getDriver();
}
}
public void setup() {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Selenium and drivers\\chromedriver.exe");
driver = new ChromeDriver();
driver.get("http://the-internet.herokuapp.com/");
driver.manage().window().maximize();
System.out.println("Set up running");
}
public void tearDown() {
driver.quit();
System.out.println("Tear down running");
}
}
I have added a Println and can see that this is never returned when I run my script.
Here's my Base Page;
package pages;
import org.openqa.selenium.WebDriver;
public class BasePage {
protected WebDriver driver;
public BasePage(WebDriver driver) {
this.driver = driver;
}
}
And my Driver
package support;
import org.openqa.selenium.WebDriver;
public class DriverSingleton {
private static WebDriver driver;
public DriverSingleton () {
}
public static WebDriver getDriver() {
return driver;
}
public static void setDriver (WebDriver driver) {
DriverSingleton.driver = driver;
}
}
Any help would be most appreciated.
It seems your DriverSingleton's driver never been initialized, and in setup() method of SeleniumSetup class, driver of SeleniumSetup is initialized and used every time you run the code , put the tearDown() at the end of setup() and your browser window will close.
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Selenium and drivers\\chromedriver.exe");
driver = new ChromeDriver();
driver.get("http://the-internet.herokuapp.com/");
driver.manage().window().maximize();
System.out.println("Set up running");
// <<------your test scenario should be placed here
tearDown();
Try extending your driver class with junit(j5 jupiter) interfaces and override the before/after methods, here is a simple example, using some of your code:
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
public class Driver implements AfterTestExecutionCallback, BeforeTestExecutionCallback, BeforeAllCallback, AfterAllCallback {
protected WebDriver driver;
#Override
public void beforeAll(ExtensionContext context) throws Exception {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Selenium and drivers\\chromedriver.exe");
driver = new ChromeDriver();
driver.get("http://the-internet.herokuapp.com/");
driver.manage().window().maximize();
System.out.println("Set up running");
}
#Override
public void afterAll(ExtensionContext context) throws Exception {
driver().quit();
}
#Override
public void beforeTestExecution(ExtensionContext context) throws Exception {
//whatever steps you need before EACH test, like navigate to homepage etc...
}
#Override
public void afterTestExecution(ExtensionContext context) throws Exception {
// steps do to after each test, best practice is to clear everything:
driver.manage().deleteAllCookies();
driver.executeScript("window.sessionStorage.clear()");
driver.executeScript("window.localStorage.clear()");
}
}

How to use same object across packages

I have 2 packages, 1st the Base package package ceccms.automation.framework and another package package ceccms.testcases as follows:
package ceccms.automation.framework;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class UniversalMethods {
public static WebDriver driver = null;
public static String chromepath = "D:\\Automation\\Web Drivers\\ChromeDriver\\chromedriver.exe";
public static String edgepath = "D:\\Automation\\Web Drivers\\EdgeDriver\\MicrosoftWebDriver.exe";
public WebDriver openBrowser (String browser, String url) {
if (browser != null) {
switch (browser) {
case "Mozilla":
driver = new FirefoxDriver();
driver.get(url);
break;
case "Chrome":
System.setProperty("webdriver.chrome.driver", chromepath);
driver = new ChromeDriver();
driver.get(url);
break;
case "Edge":
System.setProperty("webdriver.edge.driver", edgepath);
driver = new EdgeDriver();
driver.get(url);
break;
default:
System.out.println("Wrong Browser Name");
driver.quit();
}
}
driver.manage().window().maximize();
return driver;
}
}
and
package ceccms.testcases;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import ceccms.automation.framework.UniversalMethods;
public class LoginTest {
public static String url = "https://test.ceccms.com/Login.aspx?";
static UniversalMethods U = new UniversalMethods();
public static void main(String[] args) throws InterruptedException {
String browserName = "Chrome";
U.openBrowser(browserName, url);
WebElement userName = driver.findElement(By.id("txtUserName"));
userName.sendKeys("pkumar");
WebElement password = driver.findElement(By.id("txtUserPass"));
password.sendKeys("PassMe33");
Thread.sleep(3000);
driver.quit();
}
}
I am running the code through the second package. I want to use one object driver across the package without using the notation U.driver.findElement() . How can I achieve that ?
One of the solutions, you can add Page Objects, where define Web elements and give your Driver as parameter to initiate Page object class with all web elements. This will allow you to work directly with elements.
You can use it, with this structure(By extending universal method):
package ceccms.testcases;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import ceccms.automation.framework.UniversalMethods;
public class LoginTest extends UniversalMethods {
//You can access driver and method without using object reference
public static String url = "https://test.ceccms.com/Login.aspx?";
public static void main(String[] args) throws InterruptedException {
String browserName = "Chrome";
openBrowser(browserName, url);
WebElement userName = driver.findElement(By.id("txtUserName"));
userName.sendKeys("pkumar");
WebElement password = driver.findElement(By.id("txtUserPass"));
password.sendKeys("PassMe33");
Thread.sleep(3000);
driver.quit();
}
}

i got an error - java.lang.NullPointerException while running the selenium web driver code block

" Here is the code of selenium web driver in which i use POM design to define all the locators of the web page. So after running the code i got an error regarding the null pointer exception.
"
{
package Pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class LoginPage {
WebDriver driver;
By username = By.id("user_login");
By password = By.id("user_pass");
By login = By.id("wp-submit");
By rememberme = By.id("rememberme");
public LoginPage(WebDriver driver){
this.driver = driver;
}
public void typeusername(){
driver.findElement(username).sendKeys("admin");
}
public void typepassword(){
driver.findElement(password).sendKeys("demo123");
}
public void clickrememberme(){
driver.findElement(rememberme).click();
}
public void clicklogin(){
driver.findElement(login).click();
}
}
"Here in this code i created an object of a login page and call all the locators using TestNG annotations."
{
package Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import Pages.LoginPage;
public class verifylogin {
#BeforeTest
public void beforetest(){
System.setProperty("webdriver.chrome.driver","C:\\Users\\saniket.soni\\Desktop\\chrome\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://demosite.center/wordpress/wp-login.php");
}
#Test
public void verifyvalidlogin(){
WebDriver driver = null;
LoginPage login_test = new LoginPage(driver);
login_test.typeusername();
login_test.typepassword();
login_test.clickrememberme();
login_test.clicklogin();
}
}
You might want to consider studying scope in java to understand what is happening in this issue. Here is an explanation for what is happening in your case.
In your public void beforetest() method, you're creating a driver, and using it, but when that method is done the driver variable goes out of scope, and you no longer have access to it.
Later, in your verifyValidLogin method, you're creating a new driver variable, and setting it to null:
WebDriver driver = null;
Then you pass this null driver to your LoginPage here:
LoginPage login_test = new LoginPage(driver);//driver is null here
So when you use it here:
public LoginPage(WebDriver driver){
this.driver = driver;
}
public void typeusername(){
driver.findElement(username).sendKeys("admin");
}
It's null
Try making these changes:
First, save your driver somewhere when you initialize it like this:
public class verifylogin {
//STORE YOUR DRIVER SOMEWHERE!!! Like here
private WebDriver driver;
#BeforeTest
public void beforetest(){
System.setProperty("webdriver.chrome.driver","C:\\Users\\saniket.soni\\Desktop\\chrome\\chromedriver.exe");
//Store the driver in the class variable
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://demosite.center/wordpress/wp-login.php");
}
#Test
public void verifyvalidlogin(){
//Now you can use the driver you stored
LoginPage login_test = new LoginPage(driver);
login_test.typeusername();
login_test.typepassword();
login_test.clickrememberme();
login_test.clicklogin();
}
You are removing object reference by using "WebDriver driver = null" in verifyvalidlogin() method. Remove this line and try, it will work.
You instance variable 'driver' as private ('private WebDriver driver').
With 'private' access modifier you can access driver within the class but not from outside, change it to public it will work.
In beforetest() method you are instantiating the browser object and navigating to demo Url.
After that in verifyvalidlogin() method you are making driver object to null and passing this null object to Login page, here you are passing null instead of driver object.
We can solve this issue by declaring driver instance variable inside the class and outside of all methods like below.
WebDriver driver;
Instantiate this driver object in beforetest() method and pass the same driver object to LoginPage without declaring it again as mentioned below.(I executed this script in my local machine its working fine)
package Tests;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import Pages.LoginPage;
public class verifylogin {
WebDriver driver;
#BeforeTest
public void beforetest(){
System.setProperty("webdriver.chrome.driver","C:\\Users\\saniket.soni\\Desktop\\ chrome\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://demosite.center/wordpress/wp-login.php");
}
#Test
public void verifyvalidlogin(){
LoginPage login_test = new LoginPage(driver);
login_test.typeusername();
login_test.typepassword();
login_test.clickrememberme();
login_test.clicklogin();
}
}
package Pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class LoginPage {
WebDriver driver;
By username = By.id("user_login");
By password = By.id("user_pass");
By login = By.id("wp-submit");
By rememberme = By.id("rememberme");
public LoginPage(WebDriver driver){
this.driver = driver;
}
public void typeusername(){
driver.findElement(username).sendKeys("admin");
}
public void typepassword(){
driver.findElement(password).sendKeys("demo123");
}
public void clickrememberme(){
driver.findElement(rememberme).click();
}
public void clicklogin(){
driver.findElement(login).click();
}
}
Try this solution and let me know if it works for you.

How can I pass one class value into another class using Selenium WebDriver with Java?

I have one class as below:
public class Module3 {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
findElement1 a = new findElement1();
driver.get("webAddress");
driver.findElement(By.xpath("//*[#id='Username']")).sendKeys("A1");
driver.findElement(By.xpath("//*[#id='Password']")).sendKeys("1");
driver.findElement(By.xpath("//*[#id='loginBox']/form/p/button")).click();
Thread.sleep(2000L);
driver.findElement(By.xpath("//*[#id='mainNav']/li[2]/a")).click();
Thread.sleep(2000L);
driver.findElement(By.xpath("//*[#id='addNewEntryButton']")).click();
WebElement dropdown = driver.findElement(By.xpath("//*[#id='timeEntryTable']/tbody/tr[1]/td[1]/select"));
List<WebElement> dropOptions = dropdown.findElements(By.tagName("Option"));
for (int i=0; i<dropOptions.size(); i++)
{
System.out.println(dropOptions.get(i).getText());
}
Thread.sleep(2000L);
driver.findElement(By.xpath("//*[#id='timeEntryTable']/tbody/tr[1]/td[1]/select")).sendKeys(Keys.ARROW_DOWN);
driver.findElement(By.xpath("//*[#id='timeEntryTable']/tbody/tr[1]/td[5]/input")).sendKeys("5");
driver.findElement(By.xpath("//*[#id='timeEntryTable']/tbody/tr[1]/td[6]/input")).sendKeys("5");
driver.findElement(By.xpath("//*[#id='saveEntryButton']")).click();
Thread.sleep(5000L);
driver.findElement(By.xpath("html/body/div[2]/div[2]/div[2]/div/div[3]/div/header/div/button[4]")).click();
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
a.findValue();
driver.findElement(By.xpath("//button[contains(.,'submit')]")).click();
}
}
Class2:
public class FindElement1 {
static WebDriver driver = new FirefoxDriver();
public void findValue() {
driver.get("webaddress");
By by = By.xpath("//button[contains(.,'submit')]");
isElementPresent(by);
driver.findElement(By.xpath(""));
}
public boolean isElementPresent(By by){
try{
driver.findElements(by);
System.out.println("execute");
return true;
}
catch(NoSuchElementException e){
return false;
}
}
}
I want to execute class2's operation into class1 with class1's value in the mentioned place of a.findValue();Is it possible to pass the driver value of class1 into class2
Create a Common class in which common things can be kept and be used for any class:
package keya;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.*;
import org.openqa.selenium.By;
public class Common {
protected static WebDriver driver;
public Common(){
driver = new FirefoxDriver();
driver.manage().window().maximize();
}
public boolean isElementPresent(By by){
try{
driver.findElement(by);
return true;
}
catch(NoSuchElementException e){
return false;
}
}
}
As you are being tested Module3, the code should be as below:
package keya;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
public class Module3 extends Common{
public static void main(String...strings) throws Exception{
Common c = new Common();
driver.get("webAddress");
driver.findElement(By.xpath("//*[#id='Username']")).sendKeys("A1");
driver.findElement(By.xpath("//*[#id='Password']")).sendKeys("1");
driver.findElement(By.xpath("//*[#id='loginBox']/form/p/button")).click();
Thread.sleep(2000L);
driver.findElement(By.xpath("//*[#id='mainNav']/li[2]/a")).click();
Thread.sleep(2000L);
driver.findElement(By.xpath("//*[#id='addNewEntryButton']")).click();
WebElement dropdown = driver.findElement(By.xpath("//*[#id='timeEntryTable']/tbody/tr[1]/td[1]/select"));
List<WebElement> dropOptions = dropdown.findElements(By.tagName("Option"));
for (int i=0; i<dropOptions.size(); i++)
{
System.out.println(dropOptions.get(i).getText());
}
Thread.sleep(2000L);
driver.findElement(By.xpath("//*[#id='timeEntryTable']/tbody/tr[1]/td[1]/select")).sendKeys(Keys.ARROW_DOWN);
driver.findElement(By.xpath("//*[#id='timeEntryTable']/tbody/tr[1]/td[5]/input")).sendKeys("5");
driver.findElement(By.xpath("//*[#id='timeEntryTable']/tbody/tr[1]/td[6]/input")).sendKeys("5");
driver.findElement(By.xpath("//*[#id='saveEntryButton']")).click();
Thread.sleep(5000L);
driver.findElement(By.xpath("html/body/div[2]/div[2]/div[2]/div/div[3]/div/header/div/button[4]")).click();
//Here is the verification whether Submit button is present or not
c.isElementPresent(By.xpath("//button[contains(.,'submit')]"));
//Rest of the code is here
}
}
So You can use isElementPresent() method of Common class for any number of class/module. You can write more class by extending Common class so that you can use some common methods and WebDriver is being instantiated one time only in Common class.
Sure. Just remove the static keyword for the WebDriver from your second class, and create a setter or constructor with the WebDriver.
Instantiate this in your first class and set the WebDriver with your setter or constructor.

Categories

Resources