Skip to content

driver.getWindowHandles() does not respond after file download #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
iamvishwa01 opened this issue Apr 3, 2025 · 0 comments
Open

driver.getWindowHandles() does not respond after file download #196

iamvishwa01 opened this issue Apr 3, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@iamvishwa01
Copy link

  1. Launch the application and log in.

  2. Navigate to a specific screen that opens in a new window, where multiple file download links are available.

  3. Before clicking the download button, driver.getWindowHandles() correctly returns a total of 2 windows.

Set s = driver.getWindowHandles();
System.out.println(s.size()); // Returns 2
This works as expected before initiating the file download.

  1. Upon clicking the first download link, a new download window opens, and the file starts downloading.

  2. However, when attempting to retrieve all window handles again using driver.getWindowHandles(), an error occurs.
    Log: org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException
    Build info: version: '4.29.0', revision: '5fc1ec94cb'
    System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
    Driver info: org.openqa.selenium.edge.EdgeDriver
    Command: [5b5a3682c54d8cc33f465c4450dc9bac, getWindowHandles {}]
    Capabilities {acceptInsecureCerts: false, browserName: MicrosoftEdge, browserVersion: 134.0.3124.93, fedcm:accounts: true, ms:edgeOptions: {debuggerAddress: localhost:61296}, msedge: {msedgedriverVersion: 134.0.3124.93 (a9facff5fd6c..., userDataDir: C:\Users\Admin\AppData\Loca...}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:cdp: ws://localhost:61296/devtoo..., se:cdpVersion: 134.0.3124.93, setWindowRect: true, strictFileInteractability: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
    Session ID: 5b5a3682c54d8cc33f465c4450dc9bac

Driver Capabilities used:
else if (browser.equalsIgnoreCase("edge")) {
Map<String, Object> prefs = new HashMap<>();
prefs.put("download.prompt_for_download", false);
prefs.put("download.default_directory", Hooks.downloadPath);
prefs.put("safebrowsing.enabled", false);
prefs.put("safebrowsing.disable_download_protection", true);
EdgeOptions options = new EdgeOptions();
options.setExperimentalOption("prefs", prefs);
options.addArguments("--allow-running-insecure-content");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--disable-popup-blocking");
ds.setAcceptInsecureCerts(true);
System.setProperty("webdriver.chrome.driver", "C:\Users\Admin\Downloads\edgedriver_win64\msedgedriver.exe");
tldriver.set(new EdgeDriver(options));
DevTools devTools = ((EdgeDriver) tldriver.get()).getDevTools();
devTools.createSession();
devTools.send(Browser.setDownloadBehavior(
Browser.SetDownloadBehaviorBehavior.ALLOW,
Optional.empty(),
Optional.of(Hooks.downloadPath),
Optional.of(true)
));
}

@iamvishwa01 iamvishwa01 added the bug Something isn't working label Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant