I already have a code for this but what happens is that it opens the two browsers at the same time, failing my code to do what is intended. What I'm trying to do is the Chrome browser will execute first the process then after the first browser, the Chrome Incognito will launch and now do the same process.
I currently have this code:
chromeOptions.addArguments("--incognito");
ChromeDriver chromeIncognitoDriver = new ChromeDriver(chromeOptions);
for (ChromeDriver drivers : new ChromeDriver[] {(ChromeDriver) driver, chromeIncognitoDriver}) {
try {
chromeIncognitoDriver.manage().window().setSize(new Dimension(412, 915));
drivers.get("www.google.com");
//do process 1st for driver then after it, chromeIncognito driver will do the same process
} catch (Exception e) {
throw new IllegalStateException("Execution encountered an Error: " + e.getMessage());
} finally {
driver.close();
}
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.