I am working on a video consultation application where I need three separate windows to remain open simultaneously for a test case.
I am using keyword driven framework using java with selenium and following code to open up new instances of chrome every time:
public static void OPEN_BROWSER(String object,String data){
Log.info("OPENS NEW BROWSER");
try{
System.setProperty("webdriver.chrome.driver", "C:/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("use-fake-device-for-media-stream");
options.addArguments("use-fake-ui-for-media-stream");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.binary","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(capabilities);
Log.info("Chrome browser started");
System.out.println("Chrome browser started");
}catch (Exception e){
Log.info("Not able to open the Browser --- " + e.getMessage());
System.out.println("Not able to open the Browser --- " + e.getMessage());
DriverScript.bResult = false;
}
public static void GOTO_URL(String object, String data){
try{
Log.info("Navigating to URL");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(data);
//driver.navigate().to(data);
Log.info("Chrome browser started");
}catch(Exception e){
Log.info("Not able to navigate --- " + e.getMessage());
System.out.println("Not able to navigate --- " + e.getMessage());
DriverScript.bResult = false;
}
}
The problem is every time I am trying to call GOTO_URL function, since a new webdriver is launched from OPEN_BROWSER function , it takes more than 5 minutes to load a URL and even more in some cases.
Any help would be really appreciated.