Selenium maintaining single instance of driver
package com.sudas.xxxx;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class SameInstanceOfDriver {
static WebDriver webDriver;
static WebDriver driver;
public static void main(String[] args) {
driverInitializer(webDriver);
openBrowser();
openBrowser1();
}
public static void driverInitializer(WebDriver driver) {
System.setProperty("webdriver.chrome.driver", "/Users/S_Das/Documents/Java/chromedriver");
driver = new ChromeDriver();
SameInstanceOfDriver.driver = driver;
}
public static void openBrowser() {
driver.get("https://in.yahoo.com/");
}
public static void openBrowser1() {
driver.get("https://www.google.co.in/?gws_rd=ssl");
}
}
No comments:
Post a Comment