Closed Tal-E closed 8 months ago
@tal-testim we have no relation to Selenium grid. But at least an error message could help to diagnose this.
Hi @vania-pooh, sorry for the delayed response, here more details about the issue
I bring up a selenium 4 grid with 1 node chrome 1 hub and 1 ggr and run test on it using webdriver.io, since upgrading the grid to selenium 4 chrome to version 112 it started to fail
when I run the same test but I point it to the hub and not the ggr it works
the request details
METHOD: POST URL: http://localhost:4444/wd/hub/session user-agent: webdriver/7.24.0
this is the request body of the creating session in the grid
{ "capabilities": { "alwaysMatch": { "browserName": "chrome", "goog:chromeOptions": { "prefs": { "profile.default_content_setting_values.popups": 1, "profile.default_content_setting_values.automatic_downloads": 1, "plugins.always_open_pdf_externally": true, "safebrowsing.enabled": true, "profile.content_settings.exceptions.clipboard": { "[*.],*": { "last_modified": 1694706001479, "setting": 1 } }, "download.allow_office_viewer_for_download": false }, "w3c": true, "args": [ "--disable-popup-blocking", "--ignore-gpu-blacklist", "--auto-select-desktop-capture-source=Entire screen", "--ignore-certificate-errors", "--disable-features=TranslateUI", "--disable-background-networking", "--disable-sync", "--metrics-recording-only", "--disable-default-apps", "--mute-audio", "--no-first-run", "--disable-back-forward-cache", "--load-extension=/opt/testim-headless" ] }, "acceptInsecureCerts": true, "unhandledPromptBehavior": "accept" }, "firstMatch": [ {} ] }, "desiredCapabilities": { "browserName": "chrome", "goog:chromeOptions": { "prefs": { "profile.default_content_setting_values.popups": 1, "profile.default_content_setting_values.automatic_downloads": 1, "plugins.always_open_pdf_externally": true, "safebrowsing.enabled": true, "profile.content_settings.exceptions.clipboard": { "[*.],*": { "last_modified": 1694706001479, "setting": 1 } }, "download.allow_office_viewer_for_download": false }, "w3c": true, "args": [ "--disable-popup-blocking", "--ignore-gpu-blacklist", "--auto-select-desktop-capture-source=Entire screen", "--ignore-certificate-errors", "--disable-features=TranslateUI", "--disable-background-networking", "--disable-sync", "--metrics-recording-only", "--disable-default-apps", "--mute-audio", "--no-first-run", "--disable-back-forward-cache", "--load-extension=/opt/testim-headless" ] }, "acceptInsecureCerts": true, "unhandledPromptBehavior": "accept" } }
When I run this on the hub I get this response
{ "value": { "sessionId": "c8d7047678bb6dcd48e10318a4d62b2c", "capabilities": { "acceptInsecureCerts": true, "browserName": "chrome", "browserVersion": "114.0.5735.106", "chrome": { "chromedriverVersion": "114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{#1052})", "userDataDir": "/tmp/.com.google.Chrome.mMlKIO" }, "goog:chromeOptions": { "debuggerAddress": "localhost:37446" }, "networkConnectionEnabled": false, "pageLoadStrategy": "normal", "platformName": "linux", "proxy": {}, "se:bidiEnabled": false, "se:cdp": "ws://192.168.224.8:4444/session/c8d7047678bb6dcd48e10318a4d62b2c/se/cdp", "se:cdpVersion": "114.0.5735.106", "se:vnc": "ws://192.168.224.8:4444/session/c8d7047678bb6dcd48e10318a4d62b2c/se/vnc", "se:vncEnabled": true, "se:vncLocalAddress": "ws://192.168.224.8:7900", "setWindowRect": true, "strictFileInteractability": false, "timeouts": { "implicit": 0, "pageLoad": 300000, "script": 30000 }, "unhandledPromptBehavior": "accept", "webauthn:extension:credBlob": true, "webauthn:extension:largeBlob": true, "webauthn:extension:minPinLength": true, "webauthn:extension:prf": true, "webauthn:virtualAuthenticators": true } } }
Now the details what happens when I run on the ggr that points to the hub, the request details and body are the same. I don't get any response back
logs of the ggr are:
Logs of the hub
16:02:40.859 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "10d0d09e39ff153b94359d7f5a6cd0ee","eventTime": 1694707360858854637,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue","http.host": "10.26.2.173:4444","http.method": "POST","http.request_content_length": "6153265","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession","http.user_agent": "webdriver\u002f7.24.0"}}
I did checked and their is a connection between the ggr and the hub
@tal-testim what kind of error are you getting in tests?
@vania-pooh i did find this change that was made in the Chrome 112 upgrade in Selenium (4.9.0) talking about a change in w3c capabilities
https://github.com/SeleniumHQ/selenium/issues/10448
but in my case I set the w3c to true so maybe something in the ggr that overrides it
@vania-pooh
@tal-testim what kind of error are you getting in tests?
Im not getting a browser to run the test on, it fails on requests to create a session on the hub
@tal-testim what is an exact stack trace?
@vania-pooh I just don't get any response until timeout
this is the log from webdriver.io, I don't get any stack trace of the error
after timeout, I get this
its very long I can't attach it to this conversation, I added the log without the base64 string as its to long replaces it in the log with {Very long base64 string}
2023-09-14T17:05:20.354Z ERROR webdriver: Request failed with status undefined due to TimeoutError: Timeout awaiting 'request' for 90000ms when running "http://54.234.201.242:4444/wd/hub/session" with method "POST" and args "{"capabilities":{"alwaysMatch":{"browserName":"chrome","goog:chromeOptions":{"prefs":{"profile.default_content_setting_values.popups":1,"profile.default_content_setting_values.automatic_downloads":1,"plugins.always_open_pdf_externally":true,"safebrowsing.enabled":true,"profile.content_settings.exceptions.clipboard":{"[*.],*":{"last_modified":1694710760059,"setting":1}},"download.allow_office_viewer_for_download":false},"w3c":true,"extensions":["{Very long base64 string}"],\"args\":[\"--disable-popup-blocking\",\"--ignore-gpu-blacklist\",\"--auto-select-desktop-capture-source=Entire screen\",\"--ignore-certificate-errors\",\"--disable-features=TranslateUI\",\"--disable-background-networking\",\"--disable-sync\",\"--metrics-recording-only\",\"--disable-default-apps\",\"--mute-audio\",\"--no-first-run\",\"--disable-back-forward-cache\"]},\"acceptInsecureCerts\":true,\"unhandledPromptBehavior\":\"accept\"}}\"","name":"AbortError","originalError":{}},"gridInfo":{"host":"54.234.201.242","port":4444,"protocol":"http","type":"hostAndPort"},"resultId":"A0ItGck9le4yaU9U","testId":"1390eRy50WTTlou"},"name":"runner","nodeVersion":"v18.17.0","projectId":"sdghsad324ihdsa","release":false,"runnerVersion":"","time":"2023-09-14T17:06:51.363Z"}
@vania-pooh
I just made this change which made this work again, so I do think its something related to the change made in w3c at selenium release 4.9.0, https://github.com/SeleniumHQ/selenium/issues/10448
The change is in proxy.go at line 97 I removed the w3c reading capabilities
What was before:
func (c caps) capabilities(fn func(m map[string]interface{}, w3c bool, extension bool)) { if desiredCapabilities, ok := c[keys.desiredCapabilities]; ok { if m, ok := desiredCapabilities.(map[string]interface{}); ok { fn(m, false, false) } } if w3cCapabilities, ok := c[keys.w3cCapabilities]; ok { if m, ok := w3cCapabilities.(map[string]interface{}); ok { var match map[string]interface{} if alwaysMatch, ok := m[keys.alwaysMatch]; ok { if m, ok := alwaysMatch.(map[string]interface{}); ok { match = m } } else if firstMatch, ok := m[keys.firstMatch]; ok { if m, ok := firstMatch.([]interface{}); ok && len(m) > 0 { if m, ok := m[0].(map[string]interface{}); ok { match = m } } } if match != nil { fn(match, true, false) for k, v := range m { // Extension capabilities have ":" in key if ec, ok := v.(map[string]interface{}); ok && strings.Contains(k, ":") { fn(ec, true, true) } } } } } else { fn(make(map[string]interface{}), false, false) } }
what I did that now it works:
func (c caps) capabilities(fn func(m map[string]interface{}, w3c bool, extension bool)) { if desiredCapabilities, ok := c[keys.desiredCapabilities]; ok { if m, ok := desiredCapabilities.(map[string]interface{}); ok { fn(m, false, false) } } else { fn(make(map[string]interface{}), false, false) } }
@tal-testim w3c part is important and old style desired capabilities is for backwards compatibility.
@vania-pooh, i know that, but even with the capabilities that I sent which are true, without removing this section the ggr solution will not work, it will mean I will need to stop using it
@vania-pooh so no solution to that issue was found from your side?
@tal-testim this code does not change for years and is known to work. Selenium Grid contrarily frequently changes things. So we consider this an issue on their side.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi, after upgrading my Selenium hub and node chrome to version 112 this solution doesn't work any more and fails to route requests
How to reproduce: create a selenium hub and chrome in any version after 112 and create a ggr to route to it start running against the ggr and you will see the fails