Here is the scenario:
- Click a link that opens up to a new tab.
- Call getWindowHandles() and switch to the new tab.
- Use JavaScript Executor to open up the Print PopUp
- Call getWindowHandles() again to switch focus to the Print PopUp
This second getWindowHandles() call is causing my script to timeout and I'm not sure why. Could someone help me figure out what's going on with this second call? Everything is working as expected until step 4
link.click();
ArrayList<String> handles2 = new ArrayList<String> (driver.getWindowHandles());
driver.switchTo().window(handles2.get(1));
((JavascriptExecutor)driver).executeScript("window.print()");
ArrayList<String> handles3 = new ArrayList<String> (driver.getWindowHandles());
Maybe useful information:
Error Message:
org.openqa.selenium.ScriptTimeoutException: script timeout (Session info: chrome=86.0.4240.183) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: '', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_261' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 86.0.4240.183, chrome: {chromedriverVersion: 86.0.4240.22 (..., userDataDir: C:\Users\AppData\L...}, goog:chromeOptions: {debuggerAddress: localhost:}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
window.print()
line does... does it open a new browser window (I'm assuming not) or launch the browser print dialog (I'm assuming yes)? – JeffC