SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.49k stars 8.15k forks source link

[🐛 Bug]: DevToolsActivePort file doesn't exist using newheadless in linux #11874

Closed vicozohili closed 1 year ago

vicozohili commented 1 year ago

What happened?

When using --headless=new in RemoteWebDriver the error "DevToolsActivePort file doesn't exist"a occurs. If I use the old --headless the browser launches.

How can we reproduce the issue?

Use --headles=new in Linux with RemoteWebdriver.

Relevant log output

.

Operating System

Linux

Selenium version

4.8.3

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

112

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

112

Are you using Selenium Grid?

4.8.3

github-actions[bot] commented 1 year ago

@vicozohili, 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!

github-actions[bot] commented 1 year ago

Hi, @vicozohili. Please follow the issue template, we need more information to reproduce the issue.

Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue.

Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough.

Reply to this issue when all information is provided, thank you.

vicozohili commented 1 year ago

Chrome is started in linux using the below code:

ChromeOptions options = new ChromeOptions(); options.setPlatformName(Platform.ANY.name()); options.setPageLoadStrategy(PageLoadStrategy.NORMAL); options.addArguments("--headless=new"); // open headless browser options.addArguments("--start-maximized"); // open browser in maximized mode options.addArguments("--window-size=1920,1080"); // browser resolution options.addArguments("--enable-automation"); options.addArguments("--disable-infobars"); // disabling infobars options.addArguments("--disable-extensions"); // disabling extensions options.addArguments("--disable-gpu"); // applicable to windows os only options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems options.addArguments("--no-sandbox"); // bypass OS security model options.addArguments("--disable-browser-side-navigation"); options.addArguments("--whitelisted-ips"); // bypass whitelisted ips options.setExperimentalOption("excludeSwitches", new ArrayList(Arrays.asList("disable-popup-blocking"))); // disable Pop-ups options.setExperimentalOption("prefs", browserPrefs); // browser preferences options.setAcceptInsecureCerts(true); // bypass SSL certs WebDriver driver = new RemoteWebDriver(url, options);

Below is the error received when using --headless=new (note this issue does not occur with --headless)

12:33:03.524 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "a359c78a5e92956bc1f7800b75700ba1","eventTime": 1680953583107281378,"eventName": "Session request received by the Distributor","attributes": {"logger": "org.openqa.selenium.grid.distributor.local.LocalDistributor","request.payload": "[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=, --headless=new, --start-maximized, --window-size=1920,1080, --enable-automation, --disable-infobars, --disable-extensions, --disable-gpu, --disable-dev-shm-usage, --no-sandbox, --disable-browser-side-navi..., --whitelisted-ips], excludeSwitches: [disable-popup-blocking], extensions: [], prefs: {download.default_directory: \u002fopt\u002finternal\u002fma\u002fjenkins\u002fwo...}}, goog:loggingPrefs: {browser: ALL, client: ALL, driver: ALL, performance: ALL, profiler: ALL, server: ALL}, pageLoadStrategy: normal, platformName: ANY}, Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=, --headless=new, --start-maximized, --window-size=1920,1080, --enable-automation, --disable-infobars, --disable-extensions, --disable-gpu, --disable-dev-shm-usage, --no-sandbox, --disable-browser-side-navi..., --whitelisted-ips], excludeSwitches: [disable-popup-blocking], extensions: [], prefs: {download.default_directory: \u002fopt\u002finternal\u002fma\u002fjenkins\u002fwo...}}, goog:loggingPrefs: {browser: ALL, client: ALL, driver: ALL, performance: ALL, profiler: ALL, server: ALL}, pageLoadStrategy: normal}]"}}

12:33:03.525 WARN [SeleniumSpanExporter$1.lambda$export$1] - Unable to create session: Could not start a new session. Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Build info: version: '4.8.3', revision: 'b19b418e60' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.6.1.el7.x86_64', java.version: '17.0.5' Driver info: driver.version: unknown

titusfortner commented 1 year ago

I believe this is a duplicate of #11741

github-actions[bot] commented 10 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.