Skip to content

[๐Ÿ› Bug]: Using chrome --headless=new without chromedriver.exeย #15281

@KristinaPlusPlus

Description

@KristinaPlusPlus

What happened?

The newer versions of Selenium come automatically with the Selenium Manager which require the definition of a browser and a driver: https://www.selenium.dev/documentation/selenium_manager/#configuration

If I am using chrome, this is downloading chromedriver to use as the driver. But based on the recent posts for headless in chrome, this should not be required: https://developer.chrome.com/docs/chromium/headless

So, shouldn't selenium manager allow the value of the driver to just be chrome? (https://www.selenium.dev/blog/2023/headless-is-going-away/#what-are-the-two-headless-modes)

How can we reproduce the issue?

This issue is seen using the RobotFramework Selenium Open Browser keyword, where specifying chrome is installing chromedriver to cache

def create_chrome_service(log_path):
    """
    * log_path (String) path to create service
    * returns {Object} the service class
    """
    selenium = BuiltIn().get_library_instance('SeleniumLibrary')
    from selenium.webdriver.chrome.service import Service
    return Service( service_args=[f'--log-path={log_path}'] )

  ${console_log}=                                                               Set Variable    ${OUTPUT DIR}/console.log
  ${chrome_service}=                                                            Create Chrome Service    ${console_log}
  ${browser_opts}=                                                              Set Variable    add_argument("--app=https://localhost:${PORT}");add_argument("--window-size=${WINDOW_WIDTH},${WINDOW_HEIGHT}");add_argument("--disable-dev-shm-usage");add_argument("--enable-automation");add_argument("--force-device-scale-factor=1");add_argument("--aggressive-cache-discard");add_argument("--remote-debugging-pipe");set_capability('goog:loggingPrefs', { 'browser':'ALL' })
  IF     "${BROWSER}" == "headlesschrome"
      ${browser_opts}=                                                          Catenate    SEPARATOR=;    add_argument("--headless=new")    add_argument("--window-position=-2400,-2400")    ${browser_opts}
  END
  Open Browser                                                                  browser=chrome    alias=code    options=${browser_opts}    service=${chrome_service}

Relevant log output

09:55:47.719	INFO	Opening browser 'chrome' to base url 'None'.	
09:55:47.721	DEBUG	Selenium Manager binary found at: C:\Users\name\source\repos\Code\RIDE\.venv\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe	
09:55:47.721	DEBUG	Executing process: C:\Users\name\source\repos\Code\RIDE\.venv\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --debug --language-binding python --output json	
09:55:48.357	DEBUG	Sending stats to Plausible: Props { browser: "chrome", browser_version: "", os: "windows", arch: "amd64", lang: "python", selenium_version: "4.28" }	
09:55:48.357	DEBUG	chromedriver not found in PATH	
09:55:48.358	DEBUG	chrome detected at C:\Program Files\Google\Chrome\Application\chrome.exe	
09:55:48.358	DEBUG	Running command: wmic datafile where name='C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' get Version /value	
09:55:48.358	DEBUG	Output: "\r\r\n\r\r\nVersion=132.0.6834.160\r\r\n\r\r\n\r\r\n\r"	
09:55:48.358	DEBUG	Detected browser: chrome 132.0.6834.160	
09:55:48.358	DEBUG	Discovering versions from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json	
09:55:48.358	DEBUG	Required driver: chromedriver 132.0.6834.159	
09:55:48.358	DEBUG	chromedriver 132.0.6834.159 already in the cache	
09:55:48.358	DEBUG	Driver path: C:\Users\name\.cache\selenium\chromedriver\win64\132.0.6834.159\chromedriver.exe	
09:55:48.358	DEBUG	Browser path: C:\Program Files\Google\Chrome\Application\chrome.exe	
09:55:48.483	DEBUG	Started executable: `C:\Users\name\.cache\selenium\chromedriver\win64\132.0.6834.159\chromedriver.exe` in a child process with pid: 3972 using 0 to output -3	
09:55:48.999	DEBUG	POST http://localhost:53559/session {'capabilities': {'firstMatch': [{}], 'alwaysMatch': {'browserName': 'chrome', 'pageLoadStrategy': <PageLoadStrategy.normal: 'normal'>, 'goog:loggingPrefs': {'browser': 'ALL'}, 'browserVersion': None, 'goog:chromeOptions': {'extensions': [], 'binary': 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', 'args': ['--headless=new', '--window-position=-2400,-2400', '--app=https://localhost:5001/', '--window-size=1920,1000', '--disable-dev-shm-usage', '--enable-automation', '--force-device-scale-factor=1', '--aggressive-cache-discard', '--remote-debugging-pipe']}}}}	
09:55:49.001	DEBUG	Starting new HTTP connection (1): localhost:53559	
09:55:49.881	DEBUG	http://localhost:53559 "POST /session HTTP/1.1" 200 826	
09:55:49.881	DEBUG	Remote response: status=200 | data={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"132.0.6834.160","chrome":{"chromedriverVersion":"132.0.6834.159 (2d77d3fc4452661469b78f115e0aed4d71269739-refs/branch-heads/6834@{#4408})","userDataDir":"C:\\Users\\name\\AppData\\Local\\Temp\\scoped_dir3972_249364319"},"fedcm:accounts":true,"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":"a7a53cb3aca7fa3571f84594622488c2"}} | headers=HTTPHeaderDict({'Content-Length': '826', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})	
09:55:49.881	DEBUG	Finished Request	
09:55:49.881	DEBUG	POST http://localhost:53559/session/a7a53cb3aca7fa3571f84594622488c2/timeouts {'script': 5000}	
09:55:49.882	DEBUG	http://localhost:53559 "POST /session/a7a53cb3aca7fa3571f84594622488c2/timeouts HTTP/1.1" 200 14	
09:55:49.882	DEBUG	Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})	
09:55:49.882	DEBUG	Finished Request	
09:55:49.882	DEBUG	POST http://localhost:53559/session/a7a53cb3aca7fa3571f84594622488c2/timeouts {'implicit': 0}	
09:55:49.883	DEBUG	http://localhost:53559 "POST /session/a7a53cb3aca7fa3571f84594622488c2/timeouts HTTP/1.1" 200 14	
09:55:49.883	DEBUG	Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})	
09:55:49.883	DEBUG	Finished Request	
09:55:49.883	DEBUG	POST http://localhost:53559/session/a7a53cb3aca7fa3571f84594622488c2/timeouts {'pageLoad': 300000}	
09:55:49.884	DEBUG	http://localhost:53559 "POST /session/a7a53cb3aca7fa3571f84594622488c2/timeouts HTTP/1.1" 200 14	
09:55:49.884	DEBUG	Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})	
09:55:49.884	DEBUG	Finished Request	
09:55:49.884	DEBUG	Opened browser with session id a7a53cb3aca7fa3571f84594622488c2.

Operating System

Windows 10

Selenium version

Python Selenium 4.28.1

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

Chrome 132.0.6834.159

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

Chrome Driver 132.0.6834.159

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-questionApplied to questions. Issues should be closed and send the user to community resources.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions