Skip to content

[🐛 Bug]: {"code":-32000,"message":"Browser window not found"} when maximizing edge window via RemoteWebDriver in selenium grid #15174

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
tkleiber opened this issue Jan 28, 2025 · 8 comments
Labels
A-needs-triaging A Selenium member will evaluate this soon! I-defect Something is not working as intended

Comments

@tkleiber
Copy link

What happened?

Hi!

I get mentioned error when running a test against my selenum grid:

When removing "driver.manage().window().maximize();", then the test starts.
But some of my tests needs maximized browser, as they cannot set focus on items outside the visible browser window.
By the way same error occurs with driver.manage().window().setSize.

I cannot test against other drivers, as I don't have and get one installed in our business development environment.
I have already created similar issue on EdgeWebDriver: MicrosoftEdge/EdgeWebDriver#185 for the case that this will be an driver issue.

Best regards
Torsten

How can we reproduce the issue?

Run following code against your grid with a windows 10 node:


import java.net.URI;

import org.junit.Test;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class WindowsMaximizeTest {

    @Test
    public void testSelenium() throws Exception {
        DesiredCapabilities capabilities = new DesiredCapabilities();
        EdgeOptions edgeOptions = new EdgeOptions();
        edgeOptions.addArguments("--headless");
        capabilities.setCapability(EdgeOptions.CAPABILITY, edgeOptions);
        WebDriver driver = new RemoteWebDriver(URI.create("<my grid url>").toURL(), capabilities);
        driver.manage().window().maximize();
        driver.get("http://www.google.com");
        driver.quit();
    
    }

Relevant log output

org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000,"message":"Browser window not found"}
  (Session info: MicrosoftEdge=132.0.2957.115)
Build info: version: '4.13.0', revision: 'ba948ece5b*'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_431'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [1ac9d96d43084c83f03f5fda8910f4b9, maximizeCurrentWindow {}]
Capabilities {acceptInsecureCerts: false, browserName: MicrosoftEdge, browserVersion: 132.0.2957.115, fedcm:accounts: true, ms:edgeOptions: {debuggerAddress: localhost:58446}, msedge: {msedgedriverVersion: 132.0.2957.115 (f14150e8a7c..., userDataDir: C:\WINDOWS\SystemTemp\scope...}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: Windows 10, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://10.47.170.93:4444/sess..., se:cdpVersion: 132.0.2957.115, setWindowRect: true, strictFileInteractability: false, 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: 1ac9d96d43084c83f03f5fda8910f4b9
     java.lang.reflect.Constructor.newInstance(Constructor.java:423)
     org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200)
     org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133)
     org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:52)
     org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:191)
     org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)
     org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
     org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:675)
     org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:679)
     org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:1063)
     de.ikb.adf.basis.test.WindowsMaximizeTest.testSelenium(WindowsMaximizeTest.java:27)

Operating System

Window 10 grid hub and node, Windows 10 Java IDE

Selenium version

Java 8, Selenium 4.13: at the moment we are restricted to Java 8 through the Oracle ADF development framework

What are the browser(s) and version(s) where you see this issue?

Edge 132.0.2957.115

What are the browser driver(s) and version(s) where you see this issue?

EdgeWebDriver 132.0.2957.127

Are you using Selenium Grid?

4.13.0

@tkleiber tkleiber added I-defect Something is not working as intended A-needs-triaging A Selenium member will evaluate this soon! labels Jan 28, 2025
Copy link

@tkleiber, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented Jan 28, 2025

It could be something similar to this: https://forum.robotframework.org/t/launching-edge-browser/7581

You should run the test with the visible browser to see if there is something that is not letting the window get maximized.

@diemol diemol added J-awaiting answer Question asked of user; a reply moves it to triage again and removed A-needs-triaging A Selenium member will evaluate this soon! labels Jan 28, 2025
@tkleiber
Copy link
Author

I use selenium grid for the purpose of running the browsers headless for CI system. And only in this combination the problem occurs.

If I run the test locally and not headless the problem does not occur.

@diemol
Copy link
Member

diemol commented Jan 28, 2025

I understand, I am just saying that the browser in that environment has some issue and maybe there is a way for you to get an image of the browser to understand better what is going on.

@tkleiber
Copy link
Author

But your link goes to the right direction, I believe I have found the problem.
It seems the profile problem too.

A little bit of history:
Version 128 has changed the interpretation of --headless from headless=old to headless=new
So we have worked further with headless=old.
Version 132 seems now not support anymore headless=old, as least it gives a new error "DevToolsActivePort file doesn't exist".
So we have switched now to headless=new, which gives now the error "Browser window not found".
For runnung tests in ci and developing we switched between if branches for headless RemoteWebDriver and EdgeDriver to set the required options in our code.

It seems that headless=new in contrast to headless=old need for running on windows now following two lines for the profile (as we had before only in if branch for EdgeDriver):
edgeOptions.addArguments("--user-data-dir=C:\Users\" + System.getProperty("user.name") + "\AppData\Local\Microsoft\Edge\User Data");
edgeOptions.addArguments("--profile-directory=Default");

I will now test this in our ci and will close the bug, if this is succesful.

@github-actions github-actions bot added A-needs-triaging A Selenium member will evaluate this soon! and removed J-awaiting answer Question asked of user; a reply moves it to triage again labels Jan 28, 2025
@tkleiber
Copy link
Author

If I try this on CI the grid node runs under an servcice user.
When setting the --user-data-dir to the existing directory of the service user on the selenium grid node I get further the error.
If I set to the --user-data-dir to the existing directory of my existing user on the selenium grid node, the error goes away.
Are there any restrictions for service users?

@AutomatedTester
Copy link
Member

Service users don't generally have a window manager associated with them. Since browsers require a UI to work you will need to see about getting one associated with the service user. You will likely get similar issues with Firefox

@tkleiber
Copy link
Author

Remember - this is windows service user, are you sure you not mean linux?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-needs-triaging A Selenium member will evaluate this soon! I-defect Something is not working as intended
Projects
None yet
Development

No branches or pull requests

3 participants