Skip to content
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

CfT >= 119 / Selenium 4.16 / Python 3.12 / webdriver.set_window_size(x,y) returns 500 response from webdriver; webdriver.get("url") does not actually navigate to the url #91

Open
rhynot-ryan opened this issue Dec 8, 2023 · 0 comments

Comments

@rhynot-ryan
Copy link

Python 3.12
Selenium 4.16
W11P 23H2 (22631.2715)
with regular Chrome 120.0.6099.71 installed on machine

Issue exists with CfT >= 119, including CfT stable 120.0.6099.71
Issue does not exist with regular Chrome 120.0.6099.71 or CfT <= 118

calling webdriver.set_window_size(x,y) returns 500 response from webdriver and throws a WebDriverException
calling webdriver.get("url") does not actually navigate to the url though webdriver returns 200 response - the browser address bar displays just data:,; the url passed from webdriver.get("url") is not displayed and no page is rendered in the browser.

Example code:

from selenium import webdriver
import os
import logging

logger = logging.getLogger('selenium')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(os.environ.get("HOMEDRIVE").replace("\\","/") + os.environ.get("HOMEPATH").replace("\\","/") + "/Desktop/testLog.txt")
logger.addHandler(handler)

browserOpts = webdriver.ChromeOptions()
browserOpts.browser_version = "120" #change this value to different versions
browserPrefs = {"credentials_enable_service": False,"profile.password_manager_enabled": False}
browserOpts.add_experimental_option("excludeSwitches", ["enable-automation","enable-logging"])
browserOpts.add_experimental_option("prefs", browserPrefs)
browserOpts.add_argument("--disable-single-click-autofill")
browserOpts.set_capability("goog:loggingPrefs", {"performance": "ALL"})
browser = webdriver.Chrome(options=browserOpts)
browser.get("https://www.google.com")
browser.set_window_size(1300,1000)

Debug log output when run with CfT 117 or 118 (browserOpts.browser_version = "117" or browserOpts.browser_version = "118") - works as expected:

Selenium Manager binary found at: C:\Program Files\Python312\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe
Executing process: C:\Program Files\Python312\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --browser-version 117 --debug --output json
chromedriver not found in PATH
chrome detected at C:\Program Files\Google\Chrome\Application\chrome.exe
Running command: wmic datafile where name='C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' get Version /value
Output: "\r\r\n\r\r\nVersion=120.0.6099.71\r\r\n\r\r\n\r\r\n\r"
Detected browser: chrome 120.0.6099.71
Discovered chrome version (120) different to specified browser version (117)
Discovering versions from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
Required browser: chrome 117.0.5938.149
Downloading chrome 117.0.5938.149 from https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/117.0.5938.149/win64/chrome-win64.zip
chrome 117.0.5938.149 is available at C:\Users\username\.cache\selenium\chrome\win64\117.0.5938.149\chrome.exe
Discovering versions from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
Required driver: chromedriver 117.0.5938.149
chromedriver 117.0.5938.149 already in the cache
Driver path: C:\Users\username\.cache\selenium\chromedriver\win64\117.0.5938.149\chromedriver.exe
Browser path: C:\Users\username\.cache\selenium\chrome\win64\117.0.5938.149\chrome.exe
Using driver at: C:\Users\username\.cache\selenium\chromedriver\win64\117.0.5938.149\chromedriver.exe
Started executable: `C:\Users\username\.cache\selenium\chromedriver\win64\117.0.5938.149\chromedriver.exe` in a child process with pid: 38212 using 0 to output -3
POST http://localhost:56078/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "chrome", "pageLoadStrategy": "normal", "browserVersion": null, "goog:loggingPrefs": {"performance": "ALL"}, "goog:chromeOptions": {"excludeSwitches": ["enable-automation", "enable-logging"], "prefs": {"credentials_enable_service": false, "profile.password_manager_enabled": false}, "extensions": [], "binary": "C:\\Users\\username\\.cache\\selenium\\chrome\\win64\\117.0.5938.149\\chrome.exe", "args": ["--disable-single-click-autofill"]}}}}
Remote response: status=200 | data={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"117.0.5938.149","chrome":{"chromedriverVersion":"117.0.5938.149 (e3344ddefa12e60436fa28c81cf207c1afb4d0a9-refs/branch-heads/5938@{#1539})","userDataDir":"C:\\Users\\username\\AppData\\Local\\Temp\\scoped_dir38212_2000029484"},"fedcm:accounts":true,"goog:chromeOptions":{"debuggerAddress":"localhost:56137"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"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},"sessionId":"56f129c1ba61cf02470981d8c3572e43"}} | headers=HTTPHeaderDict({'Content-Length': '886', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
Finished Request
POST http://localhost:56078/session/56f129c1ba61cf02470981d8c3572e43/url {"url": "https://www.google.com"}
Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
Finished Request
POST http://localhost:56078/session/56f129c1ba61cf02470981d8c3572e43/window/rect {"x": null, "y": null, "width": 1300, "height": 1000}
Remote response: status=200 | data={"value":{"height":1000,"width":1300,"x":10,"y":10}} | headers=HTTPHeaderDict({'Content-Length': '52', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
Finished Request

Debug log output when run with regular/installed Chrome (browserOpts.browser_version = "120" with regular Chrome 120 installed on machine) - works as expected:

Selenium Manager binary found at: C:\Program Files\Python312\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe
Executing process: C:\Program Files\Python312\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --browser-version 120 --debug --output json
chromedriver not found in PATH
chrome detected at C:\Program Files\Google\Chrome\Application\chrome.exe
Running command: wmic datafile where name='C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' get Version /value
Output: "\r\r\n\r\r\nVersion=120.0.6099.71\r\r\n\r\r\n\r\r\n\r"
Detected browser: chrome 120.0.6099.71
Required driver: chromedriver 120.0.6099.71
chromedriver 120.0.6099.71 already in the cache
Driver path: C:\Users\username\.cache\selenium\chromedriver\win64\120.0.6099.71\chromedriver.exe
Browser path: C:\Program Files\Google\Chrome\Application\chrome.exe
Using driver at: C:\Users\username\.cache\selenium\chromedriver\win64\120.0.6099.71\chromedriver.exe
Started executable: `C:\Users\username\.cache\selenium\chromedriver\win64\120.0.6099.71\chromedriver.exe` in a child process with pid: 43804 using 0 to output -3
POST http://localhost:56293/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "chrome", "pageLoadStrategy": "normal", "browserVersion": null, "goog:loggingPrefs": {"performance": "ALL"}, "goog:chromeOptions": {"excludeSwitches": ["enable-automation", "enable-logging"], "prefs": {"credentials_enable_service": false, "profile.password_manager_enabled": false}, "extensions": [], "binary": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", "args": ["--disable-single-click-autofill"]}}}}
Remote response: status=200 | data={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"120.0.6099.71","chrome":{"chromedriverVersion":"120.0.6099.71 (9729082fe6174c0a371fc66501f5efc5d69d3d2b-refs/branch-heads/6099_56@{#13})","userDataDir":"C:\\Users\\username\\AppData\\Local\\Temp\\scoped_dir43804_2055203010"},"fedcm:accounts":true,"goog:chromeOptions":{"debuggerAddress":"localhost:56304"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"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},"sessionId":"89272050a411402c907132b61eaa8dcd"}} | headers=HTTPHeaderDict({'Content-Length': '885', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
Finished Request
POST http://localhost:56293/session/89272050a411402c907132b61eaa8dcd/url {"url": "https://www.google.com"}
Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
Finished Request
POST http://localhost:56293/session/89272050a411402c907132b61eaa8dcd/window/rect {"x": null, "y": null, "width": 1300, "height": 1000}
Remote response: status=200 | data={"value":{"height":1000,"width":1300,"x":10,"y":10}} | headers=HTTPHeaderDict({'Content-Length': '52', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
Finished Request

Debug log output when run with CfT 119, 120, 121 (beta), or 122 (canary) (browserOpts.browser_version = "119" or browserOpts.browser_version = "120" without regular Chrome 120 installed or browserOpts.browser_version = "beta" or browserOpts.browser_version = "canary") - browser does not actually navigate to URL and calling set_window_size(x,y) returns a 500 response from webdriver:

Selenium Manager binary found at: C:\Program Files\Python312\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe
Executing process: C:\Program Files\Python312\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --browser-version stable --debug --output json
chromedriver not found in PATH
chrome not found in PATH
Running command: REG QUERY HKCU\Software\Google\Chrome\BLBeacon /v version
Output: "\r\nHKEY_CURRENT_USER\\Software\\Google\\Chrome\\BLBeacon\r\n    version    REG_SZ    111.0.6099.71\r\n"
Detected browser: chrome 111.0.6099.71
Discovered online chrome version (120) is different to the detected local chrome version (111)
Discovering versions from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
Required browser: chrome 120.0.6099.71
Downloading chrome 120.0.6099.71 from https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/120.0.6099.71/win64/chrome-win64.zip
chrome 120.0.6099.71 is available at C:\Users\username\.cache\selenium\chrome\win64\120.0.6099.71\chrome.exe
Required driver: chromedriver 120.0.6099.71
chromedriver 120.0.6099.71 already in the cache
Driver path: C:\Users\username\.cache\selenium\chromedriver\win64\120.0.6099.71\chromedriver.exe
Browser path: C:\Users\username\.cache\selenium\chrome\win64\120.0.6099.71\chrome.exe
Using driver at: C:\Users\username\.cache\selenium\chromedriver\win64\120.0.6099.71\chromedriver.exe
Started executable: `C:\Users\username\.cache\selenium\chromedriver\win64\120.0.6099.71\chromedriver.exe` in a child process with pid: 47812 using 0 to output -3
POST http://localhost:58846/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "chrome", "pageLoadStrategy": "normal", "browserVersion": null, "goog:loggingPrefs": {"performance": "ALL"}, "goog:chromeOptions": {"excludeSwitches": ["enable-automation", "enable-logging"], "prefs": {"credentials_enable_service": false, "profile.password_manager_enabled": false}, "extensions": [], "binary": "C:\\Users\\username\\.cache\\selenium\\chrome\\win64\\120.0.6099.71\\chrome.exe", "args": ["--disable-single-click-autofill"]}}}}
Remote response: status=200 | data={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"120.0.6099.71","chrome":{"chromedriverVersion":"120.0.6099.71 (9729082fe6174c0a371fc66501f5efc5d69d3d2b-refs/branch-heads/6099_56@{#13})","userDataDir":"C:\\Users\\username\\AppData\\Local\\Temp\\scoped_dir47812_808037031"},"fedcm:accounts":true,"goog:chromeOptions":{"debuggerAddress":"localhost:58971"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"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},"sessionId":"f6ad6fa5fd6c2d85a42d6472da6a2c6c"}} | headers=HTTPHeaderDict({'Content-Length': '884', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
Finished Request
POST http://localhost:58846/session/f6ad6fa5fd6c2d85a42d6472da6a2c6c/url {"url": "https://www.google.com"}
Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
Finished Request
POST http://localhost:58846/session/f6ad6fa5fd6c2d85a42d6472da6a2c6c/window/rect {"x": null, "y": null, "width": 1300, "height": 1000}
Remote response: status=500 | data={"value":{"error":"unknown error","message":"unknown error: unhandled inspector error: {\"code\":-32000,\"message\":\"Browser window not found\"}\n  (Session info: chrome=120.0.6099.71)","stacktrace":"\tGetHandleVerifier [0x00007FF6A4804D02+56194]\n\t(No symbol) [0x00007FF6A47704B2]\n\t(No symbol) [0x00007FF6A46176AA]\n\t(No symbol) [0x00007FF6A460112C]\n\t(No symbol) [0x00007FF6A45FEE85]\n\t(No symbol) [0x00007FF6A45FF7CE]\n\t(No symbol) [0x00007FF6A45FF700]\n\t(No symbol) [0x00007FF6A45F10D3]\n\t(No symbol) [0x00007FF6A45F3135]\n\t(No symbol) [0x00007FF6A46B84B8]\n\t(No symbol) [0x00007FF6A4685E7A]\n\t(No symbol) [0x00007FF6A46A2786]\n\t(No symbol) [0x00007FF6A4685C23]\n\t(No symbol) [0x00007FF6A4654A45]\n\t(No symbol) [0x00007FF6A4655AD4]\n\tGetHandleVerifier [0x00007FF6A4B7D5BB+3695675]\n\tGetHandleVerifier [0x00007FF6A4BD6197+4059159]\n\tGetHandleVerifier [0x00007FF6A4BCDF63+4025827]\n\tGetHandleVerifier [0x00007FF6A489F029+687785]\n\t(No symbol) [0x00007FF6A477B508]\n\t(No symbol) [0x00007FF6A4777564]\n\t(No symbol) [0x00007FF6A47776E9]\n\t(No symbol) [0x00007FF6A4768094]\n\tBaseThreadInitThunk [0x00007FF9DE65257D+29]\n\tRtlUserThreadStart [0x00007FF9E094AA58+40]\n"}} | headers=HTTPHeaderDict({'Content-Length': '1192', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
Finished Request

browserOpts.browser_version = "117" GOOD using CfT 117.0.5938.149
browserOpts.browser_version = "118" GOOD using CfT 118.0.5993.70
browserOpts.browser_version = "119" CfT 119.0.6045.105 - SAME PROBLEM - url does not load & resizing window throws exception
browserOpts.browser_version = "beta" CfT 121.0.6167.8 - SAME PROBLEM - url does not load & resizing window throws exception
browserOpts.browser_version = "canary" CfT 122.0.6170.0 - SAME PROBLEM - url does not load & resizing window throws exception

With regular/installed Chrome 120.0.6099.71:
browserOpts.browser_version = "stable" Chrome REGULAR 120.0.6099.71 - NO ISSUE

I renamed the directory of my installed regular Chrome and changed the relevant HKCU key so it wouldnt be found by Selenium Manager and force it to dowload CfT:
browserOpts.browser_version = "stable" CfT 120.0.6099.71 - SAME PROBLEM - url does not load & resizing window throws exception

So it appears that the issue is related to CfT version 119 and later as 'regular' Chrome 120 does not exhibit the issue but CfT >= 119 (thru 122 canary) DOES give the error.

Originally reported to SeleniumHQ (SeleniumHQ/selenium#13257) but after further troubleshooting and discovering the issue only affected CfT and not regular Chrome, was asked to report here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant