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

[🐛 Bug]: Chrome docker tags 124.0 / 4.20 SessionNotCreatedException #2225

Open
kisuro opened this issue Apr 25, 2024 · 34 comments
Open

[🐛 Bug]: Chrome docker tags 124.0 / 4.20 SessionNotCreatedException #2225

kisuro opened this issue Apr 25, 2024 · 34 comments

Comments

@kisuro
Copy link

kisuro commented Apr 25, 2024

What happened?

I use selenium as a service in gitlab-ci.yml (selenium/standalone-chrome:latest)
Before the current update this morning, everything was fine.
However, after tag updates to 4.20 and 124 this morning, I started getting an error on all environments

Tried updating selenium to 4.20,
tried tags :
selenium/standalone-chrome:124.0
selenium/standalone-chrome:latest
selenium/standalone-chrome:4.20
All of these options return the Message: Failed to start a new session

When setting tag 123.0 (selenium/standalone-chrome:123.0) everything works correctly.

Command used to start Selenium Grid with Docker (or Kubernetes)

m_test:
  image: $CONTAINER_TEST_IMAGE
  allow_failure: true
  stage: test
  services:
    - name: selenium/standalone-chrome:latest
      alias: chrome
      variables:
        SE_NODE_OVERRIDE_MAX_SESSIONS: 'true'
        SE_NODE_MAX_SESSIONS: '5'

Relevant log output

E       selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
209E       Host info: host: '23ef3a12361a', ip: '172.20.0.2'
210E       Build info: version: '4.20.0', revision: '866c76ca80'
211E       System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
212E       Driver info: driver.version: unknown
213E       Stacktrace:
214E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:220)
215E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:70)
216E           at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
217E           at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:464)
218E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:651)
219E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:570)
220E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:830)
221E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:790)
222E           at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
223E           at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
224E           at java.lang.Thread.run (None:-1)
225/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:229: SessionNotCreatedException
226

Operating System

Linux

Docker Selenium version (image tag)

latest

Selenium Grid chart version (chart version)

No response

Copy link

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

@VietND96
Copy link
Member

Can you provide the test to reproduce and what binding version is used? Since our CI tests not seen this failure

@kisuro
Copy link
Author

kisuro commented Apr 25, 2024

Can you provide the test to reproduce and what binding version is used? Since our CI tests not seen this failure

docker:20.10.12-dind

I use pytest for tests, with fixtures, objects, etc, but the problem is that all 100 tests crashed with this error without even starting, the browser was not initialised.
Even the simplest test to open any page causes this problem.

Also tried a local run with selenium 4.20 on Chrome 124.0 - all runs successfully.

@VietND96
Copy link
Member

I guess there is lib using HTTP/1.1 and it isn't compatible to be proceeded by selenium as the message java.io.IOException: HTTP/1.1 header parser received no bytes

@VietND96
Copy link
Member

@diemol, this case is Python binding. Do you have any idea how to troubleshoot?

@kisuro
Copy link
Author

kisuro commented Apr 25, 2024

example simple test:

import pytest

from framework.application import Application

@pytest.mark.selenium
def test_selenium(app: Application):
    app.wd.get('https://www.google.com')

error log (selenium/standalone-chrome:latest):

ERROR test/mobile/test_selenium.py::test_selenium - selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
Host info: host: '5e6c8b61ce37', ip: '172.20.0.2'
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
Driver info: driver.version: unknown
Stacktrace:
    at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:220)
    at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:70)
    at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
    at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:464)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:651)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:570)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:830)
    at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:790)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
    at java.lang.Thread.run (None:-1)

successful log (just updated tag: selenium/standalone-chrome:123.0):

platform linux -- Python 3.10.2, pytest-8.1.1, pluggy-1.5.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: n
configfile: pytest.ini
plugins: xdist-3.5.0, rerunfailures-14.0, jira-xray-0.8.11, jira-0.3.20, dependency-0.6.0, allure-pytest-2.13.5, bdd-5.0.0
collecting ... collected 156 items / 1[55] deselected / 1 selected
test/mobile/test_selenium.py::test_selenium 
-------------------------------- live log setup --------------------------------
2024-04-25 10:51:11 [    INFO] REMOTE MODE: FLAG DEVICE EMULATION:False (application.py:85)
2024-04-25 10:51:11 [    INFO] BROWSER:chrome VER:123.0.6312.86 (application.py:90)
2024-04-25 10:51:11 [    INFO] Browser TimeZone set to: Europe/Berlin (application.py:92)
PASSED                                                                   [100%]
    

@diemol
Copy link
Member

diemol commented Apr 25, 2024

What version of Selenium Python?

@kisuro
Copy link
Author

kisuro commented Apr 25, 2024

What version of Selenium Python?

now updated to 4.20.0, was 4.19.0 .
For both same result for tag 'latest' - error

@VietND96
Copy link
Member

VietND96 commented May 6, 2024

@kisuro, can you try to start the container with set SE_LOG_LEVEL=FINE to see more details for reason Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes
Also, at client binding, in the method app.wd.get(), is there any capabilities set related to the browser version or driver path there?

@kisuro
Copy link
Author

kisuro commented May 8, 2024

@kisuro, can you try to start the container with set SE_LOG_LEVEL=FINE to see more details for reason Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes Also, at client binding, in the method app.wd.get(), is there any capabilities set related to the browser version or driver path there?

pre:

  • added to gitlab-ci.yml log level variable (hope its correct, because I doesnt see any new details in log)
marked_test:
  image: $CONTAINER_TEST_IMAGE
  allow_failure: true
  stage: test
  services:
    - name: selenium/standalone-chrome:latest
      alias: chrome
      variables:
        SE_NODE_OVERRIDE_MAX_SESSIONS: 'true'
        SE_NODE_MAX_SESSIONS: '8'
        SE_LOG_LEVEL: 'FINE'

Result log:
selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes
Host info: host: '2f7cc90ad43a', ip: '172.0.0.0'
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
Driver info: driver.version: unknown
Stacktrace:
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:220)
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:70)
at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:464)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:651)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:570)
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:830)
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:790)
at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
at java.lang.Thread.run (None:-1)

  1. Options for remote chrome driver in app:
    def _chrome_options(browser_mode: str, device_emulation: bool) -> Options:
        opt = Options()
        opt.add_argument("--no-sandbox")
        opt.add_argument("--incognito")
        opt.add_argument("--verbose")
        opt.add_argument("--ignore-certificate-errors")
        opt.add_argument("--start-maximized")
        opt.add_experimental_option("excludeSwitches", ["enable-automation"])
        opt.add_experimental_option("useAutomationExtension", False)
        opt.add_argument("--allow-running-insecure-content")
        opt.add_argument("--disable-dev-shm-usage")
        opt.add_experimental_option('prefs', {
            "download.default_directory": pytest.root_dir,  # Change default directory for downloads
            "download.prompt_for_download": False,  # To auto download the file
            "download.directory_upgrade": True,
            "plugins.always_open_pdf_externally": True  # It will not show PDF directly in chrome
        })
        opt.page_load_strategy = "normal"

        if device_emulation:
            opt.add_experimental_option("mobileEmulation", mobile_emulation)
        else:
            opt.add_argument("--window-size=1920,1080")

        if browser_mode != "normal":
            opt.add_argument("--headless")

        return opt
 remote_url = f"http://{browser}:4444"      
 wd_remote = webdriver.Remote(remote_url, options=self._chrome_options(browser_mode, device_emulation))

@VietND96
Copy link
Member

@kisuro, is this issue able to reproduce with the recent latest or chrome 125.0 image tag?
If yes, can you provide which version of Docker engine, docker-compose that you are using?

@VietND96 VietND96 added this to the 4.22 milestone May 24, 2024
@kisuro
Copy link
Author

kisuro commented May 28, 2024

@kisuro, is this issue able to reproduce with the recent latest or chrome 125.0 image tag? If yes, can you provide which version of Docker engine, docker-compose that you are using?

Yes, its still reproduce.
selenium: 4.21.0
chrome: 125

log:

E       selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
E       Host info: host: 'bb8d6b99471b', ip: 'xxx.xx.xx.xx'
E       Build info: version: '4.21.0', revision: '79ed462ef4'
E       System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
E       Driver info: driver.version: unknown
E       Stacktrace:
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:221)
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:71)
E           at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
E           at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:469)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:652)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:571)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:831)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:791)
E           at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
E           at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
E           at java.lang.Thread.run (None:-1)
/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:229: SessionNotCreatedException

image: docker:20.10.9

d.compose not in use.

stage: test
services:
- name: selenium/standalone-chrome:latest

@VietND96
Copy link
Member

I feel the issue could be with Docker engine 20.10.9. If there is no dependency on upgrading thrid-party, can you try upgrade docker engine to 20.10.24 (the latest patch in major 20.10) and confirm?

@kisuro
Copy link
Author

kisuro commented Jun 12, 2024

I feel the issue could be with Docker engine 20.10.9. If there is no dependency on upgrading thrid-party, can you try upgrade docker engine to 20.10.24 (the latest patch in major 20.10) and confirm?

Was updated image docker version:

docker_build:
  image: docker:20.10.24
  stage: build

But result the same: as I can see:

E       selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
E       Host info: host: '3fdfdc3febf', ip: '***.**.**.**'
E       Build info: version: '4.21.0', revision: '79ed42ef4'
E       System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
E       Driver info: driver.version: unknown
E       Stacktrace:
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:221)
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:71)
E           at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
E           at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:469)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:652)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:571)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:831)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:791)
E           at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
E           at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
E           at java.lang.Thread.run (None:-1)
/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:229: SessionNotCreatedException 

@Stifman
Copy link

Stifman commented Jun 25, 2024

@kisuro Perhaps you found a way to solve this problem and could share?

@kisuro
Copy link
Author

kisuro commented Jul 2, 2024

@kisuro Perhaps you found a way to solve this problem and could share?

No. I still have this problem with last version, still using 123.0.6312.86 and hope someone from team help me resolve it

@kisuro
Copy link
Author

kisuro commented Jul 22, 2024

@VietND96, @diemol any update, idea?
I still have issues on my side with latest chrome image.
docker:20.10.24

logs

Starting service selenium/standalone-chrome:latest...
Pulling docker image selenium/standalone-chrome:latest ...
.. 
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fc10a683880>
response = {'status': 500, 'value': '{\n  "value": {\n    "error": "session not created",\n    "message": "Could not start a new ... "className": "java.lang.Thread",\n        "lineNumber": -1,\n        "classLoaderName": null\n      }\n    ]\n  }\n}'}
    def check_response(self, response: Dict[str, Any]) -> None:
        """Checks that a JSON response from the WebDriver does not have an
        error.
    
        :Args:
         - response - The JSON response from the WebDriver server as a dictionary
           object.
    
        :Raises: If the response contains an error message.
        """
        status = response.get("status", None)
        if not status or status == ErrorCode.SUCCESS:
            return
        value = None
        message = response.get("message", "")
        screen: str = response.get("screen", "")
        stacktrace = None
        if isinstance(status, int):
            value_json = response.get("value", None)
            if value_json and isinstance(value_json, str):
                import json
    
                try:
                    value = json.loads(value_json)
                    if len(value) == 1:
                        value = value["value"]
                    status = value.get("error", None)
                    if not status:
                        status = value.get("status", ErrorCode.UNKNOWN_ERROR)
                        message = value.get("value") or value.get("message")
                        if not isinstance(message, str):
                            value = message
                            message = message.get("message")
                    else:
                        message = value.get("message", None)
                except ValueError:
                    pass
    
        exception_class: Type[WebDriverException]
        e = ErrorCode()
        error_codes = [item for item in dir(e) if not item.startswith("__")]
        for error_code in error_codes:
            error_info = getattr(ErrorCode, error_code)
            if isinstance(error_info, list) and status in error_info:
                exception_class = getattr(ExceptionMapping, error_code, WebDriverException)
                break
        else:
            exception_class = WebDriverException
    
        if not value:
            value = response["value"]
        if isinstance(value, str):
            raise exception_class(value)
        if message == "" and "message" in value:
            message = value["message"]
    
        screen = None  # type: ignore[assignment]
        if "screen" in value:
            screen = value["screen"]
    
        stacktrace = None
        st_value = value.get("stackTrace") or value.get("stacktrace")
        if st_value:
            if isinstance(st_value, str):
                stacktrace = st_value.split("\n")
            else:
                stacktrace = []
                try:
                    for frame in st_value:
                        line = frame.get("lineNumber", "")
                        file = frame.get("fileName", "<anonymous>")
                        if line:
                            file = f"{file}:{line}"
                        meth = frame.get("methodName", "<anonymous>")
                        if "className" in frame:
                            meth = f"{frame['className']}.{meth}"
                        msg = "    at %s (%s)"
                        msg = msg % (meth, file)
                        stacktrace.append(msg)
                except TypeError:
                    pass
        if exception_class == UnexpectedAlertPresentException:
            alert_text = None
            if "data" in value:
                alert_text = value["data"].get("text")
            elif "alert" in value:
                alert_text = value["alert"].get("text")
            raise exception_class(message, screen, stacktrace, alert_text)  # type: ignore[call-arg]  # mypy is not smart enough here
>       raise exception_class(message, screen, stacktrace)
E       selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
E       Host info: host: 'ce833a2c63e9', ip: 'xxx.xx.x.x'
E       Build info: version: '4.22.0', revision: 'c5f3146703'
E       System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
E       Driver info: driver.version: unknown
E       Stacktrace:
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:221)
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:71)
E           at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
E           at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:469)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:652)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:571)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:834)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:[79](https://gitlab.devops.telekom.de/oneapp/apps/mavi_automation/mavi_automation/-/jobs/181162486#L79)1)
E           at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
E           at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
E           at java.lang.Thread.run (None:-1)
/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:229: SessionNotCreatedException
______________________ ERROR at teardown of test_selenium ______________________
self = <allure_commons._allure.fixture object at 0x7fc10a6[83](https://gitlab.xxx)3d0>, args = ()
kwargs = {}
    def __call__(self, *args, **kwargs):
        self.parameters = func_parameters(self._fixture_function, *args, **kwargs)
    
        with self:
>           return self._fixture_function(*args, **kwargs)
/usr/local/lib/python3.10/site-packages/allure_commons/_allure.py:221:

@VietND96
Copy link
Member

What if you deploy Hub container with env var set SE_JAVA_OPTS=-Djdk.httpclient.keepalive.timeout=300

@kisuro
Copy link
Author

kisuro commented Jul 29, 2024

What if you deploy Hub container with env var set SE_JAVA_OPTS=-Djdk.httpclient.keepalive.timeout=300

docker:20.10.24 and added SE_JAVA_OPTS
still have issue, just change chrome:123.0 to chrome:latest

marked_test:
  image: $CONTAINER_TEST_IMAGE
  allow_failure: true
  stage: test
  services:
    - name: selenium/standalone-chrome:latest
      alias: chrome
      variables:
        SE_NODE_OVERRIDE_MAX_SESSIONS: 'true'
        SE_NODE_MAX_SESSIONS: '8'
        SE_JAVA_OPTS: '-Djdk.httpclient.keepalive.timeout=300'

LOG:

/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:212: in __init__
    self.start_session(capabilities)
/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:299: in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:354: in execute
    self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7f5f50c96650>
response = {'status': 500, 'value': '{\n  "value": {\n    "error": "session not created",\n    "message": "Could not start a new ..."className": "java.lang.Thread",\n        "lineNumber": 840,\n        "classLoaderName": null\n      }\n    ]\n  }\n}'}
    def check_response(self, response: Dict[str, Any]) -> None:
        """Checks that a JSON response from the WebDriver does not have an
        error.
    
        :Args:
         - response - The JSON response from the WebDriver server as a dictionary
           object.
    
        :Raises: If the response contains an error message.
        """
        status = response.get("status", None)
        if not status or status == ErrorCode.SUCCESS:
            return
        value = None
        message = response.get("message", "")
        screen: str = response.get("screen", "")
        stacktrace = None
        if isinstance(status, int):
            value_json = response.get("value", None)
            if value_json and isinstance(value_json, str):
                import json
    
                try:
                    value = json.loads(value_json)
                    if len(value) == 1:
                        value = value["value"]
                    status = value.get("error", None)
                    if not status:
                        status = value.get("status", ErrorCode.UNKNOWN_ERROR)
                        message = value.get("value") or value.get("message")
                        if not isinstance(message, str):
                            value = message
                            message = message.get("message")
                    else:
                        message = value.get("message", None)
                except ValueError:
                    pass
    
        exception_class: Type[WebDriverException]
        e = ErrorCode()
        error_codes = [item for item in dir(e) if not item.startswith("__")]
        for error_code in error_codes:
            error_info = getattr(ErrorCode, error_code)
            if isinstance(error_info, list) and status in error_info:
                exception_class = getattr(ExceptionMapping, error_code, WebDriverException)
                break
        else:
            exception_class = WebDriverException
    
        if not value:
            value = response["value"]
        if isinstance(value, str):
            raise exception_class(value)
        if message == "" and "message" in value:
            message = value["message"]
    
        screen = None  # type: ignore[assignment]
        if "screen" in value:
            screen = value["screen"]
    
        stacktrace = None
        st_value = value.get("stackTrace") or value.get("stacktrace")
        if st_value:
            if isinstance(st_value, str):
                stacktrace = st_value.split("\n")
            else:
                stacktrace = []
                try:
                    for frame in st_value:
                        line = frame.get("lineNumber", "")
                        file = frame.get("fileName", "<anonymous>")
                        if line:
                            file = f"{file}:{line}"
                        meth = frame.get("methodName", "<anonymous>")
                        if "className" in frame:
                            meth = f"{frame['className']}.{meth}"
                        msg = "    at %s (%s)"
                        msg = msg % (meth, file)
                        stacktrace.append(msg)
                except TypeError:
                    pass
        if exception_class == UnexpectedAlertPresentException:
            alert_text = None
            if "data" in value:
                alert_text = value["data"].get("text")
            elif "alert" in value:
                alert_text = value["alert"].get("text")
            raise exception_class(message, screen, stacktrace, alert_text)  # type: ignore[call-arg]  # mypy is not smart enough here
>       raise exception_class(message, screen, stacktrace)
E       selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
E       Host info: host: '07ac380319xx', ip: 'xxx.xx.xx'
E       Build info: version: '4.23.0', revision: '77010cd'
E       System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
E       Driver info: driver.version: unknown
E       Stacktrace:
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:221)
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:[71](https://gitlab.devops.telekom.de/oneapp/apps/oneshop_automation/oneshop_automation/-/jobs/182540648#L71))
E           at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
E           at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:469)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:654)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:5[73](https://gitlab.devops.telekom.de/oneapp/apps/oneshop_automation/oneshop_automation/-/jobs/182540648#L73))
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:836)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:793)
E           at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
E           at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
E           at java.lang.Thread.run (Thread.java:840)
/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py:229: SessionNotCreatedException

@VietND96
Copy link
Member

Can you also try to use image tag nightly e.g selenium/standalone-chrome:nightly
with env var SE_JAVA_OPTS=-Dwebdriver.httpclient.version=HTTP_1_1

@kisuro
Copy link
Author

kisuro commented Jul 30, 2024

Can you also try to use image tag nightly e.g selenium/standalone-chrome:nightly with env var SE_JAVA_OPTS=-Dwebdriver.httpclient.version=HTTP_1_1

Same result.

gitlab-ci.yml

marked_test:
  image: $CONTAINER_TEST_IMAGE
  allow_failure: true
  stage: test
  services:
    - name: selenium/standalone-chrome:nightly
      alias: chrome
      variables:
        SE_NODE_OVERRIDE_MAX_SESSIONS: 'true'
        SE_NODE_MAX_SESSIONS: '5'
        SE_JAVA_OPTS: '-Dwebdriver.httpclient.version=HTTP_1_1'

LOG

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fb52b0d2770>
response = {'status': 500, 'value': '{\n  "value": {\n    "error": "session not created",\n    "message": "Could not start a new ..."className": "java.lang.Thread",\n        "lineNumber": 840,\n        "classLoaderName": null\n      }\n    ]\n  }\n}'}
    def check_response(self, response: Dict[str, Any]) -> None:
        """Checks that a JSON response from the WebDriver does not have an
        error.
    
        :Args:
         - response - The JSON response from the WebDriver server as a dictionary
           object.
    
        :Raises: If the response contains an error message.
        """
        status = response.get("status", None)
        if not status or status == ErrorCode.SUCCESS:
            return
        value = None
        message = response.get("message", "")
        screen: str = response.get("screen", "")
        stacktrace = None
        if isinstance(status, int):
            value_json = response.get("value", None)
            if value_json and isinstance(value_json, str):
                import json
    
                try:
                    value = json.loads(value_json)
                    if len(value) == 1:
                        value = value["value"]
                    status = value.get("error", None)
                    if not status:
                        status = value.get("status", ErrorCode.UNKNOWN_ERROR)
                        message = value.get("value") or value.get("message")
                        if not isinstance(message, str):
                            value = message
                            message = message.get("message")
                    else:
                        message = value.get("message", None)
                except ValueError:
                    pass
    
        exception_class: Type[WebDriverException]
        e = ErrorCode()
        error_codes = [item for item in dir(e) if not item.startswith("__")]
        for error_code in error_codes:
            error_info = getattr(ErrorCode, error_code)
            if isinstance(error_info, list) and status in error_info:
                exception_class = getattr(ExceptionMapping, error_code, WebDriverException)
                break
        else:
            exception_class = WebDriverException
    
        if not value:
            value = response["value"]
        if isinstance(value, str):
            raise exception_class(value)
        if message == "" and "message" in value:
            message = value["message"]
    
        screen = None  # type: ignore[assignment]
        if "screen" in value:
            screen = value["screen"]
    
        stacktrace = None
        st_value = value.get("stackTrace") or value.get("stacktrace")
        if st_value:
            if isinstance(st_value, str):
                stacktrace = st_value.split("\n")
            else:
                stacktrace = []
                try:
                    for frame in st_value:
                        line = frame.get("lineNumber", "")
                        file = frame.get("fileName", "<anonymous>")
                        if line:
                            file = f"{file}:{line}"
                        meth = frame.get("methodName", "<anonymous>")
                        if "className" in frame:
                            meth = f"{frame['className']}.{meth}"
                        msg = "    at %s (%s)"
                        msg = msg % (meth, file)
                        stacktrace.append(msg)
                except TypeError:
                    pass
        if exception_class == UnexpectedAlertPresentException:
            alert_text = None
            if "data" in value:
                alert_text = value["data"].get("text")
            elif "alert" in value:
                alert_text = value["alert"].get("text")
            raise exception_class(message, screen, stacktrace, alert_text)  # type: ignore[call-arg]  # mypy is not smart enough here
>       raise exception_class(message, screen, stacktrace)
E       selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
E       Host info: host: '5f[75](https://gitlab.xxx.com/-/jobs/182657548#L75)9cf84171', ip: 'xxx.xx.xx'
E       Build info: version: '4.23.0', revision: '1ad8846'
E       System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.11'
E       Driver info: driver.version: unknown
E       Stacktrace:
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:221)
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:71)
E           at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
E           at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:469)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:654)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:573)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:836)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:[79](https://gitlab.devops.telekom.de/oneapp/apps/mavi_automation/mavi_automation/-/jobs/182657548#L79)3)
E           at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
E           at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
E           at java.lang.Thread.run (Thread.java:[84](https://gitlab.devops.telekom.de/oneapp/apps/mavi_automation/mavi_automation/-/jobs/182657548#L84)0)
/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:229: SessionNotCreatedException

@VietND96
Copy link
Member

Ok, how about all the capabilities that you set from binding while creating the RemoteWebDriver?

@kisuro
Copy link
Author

kisuro commented Jul 30, 2024

Ok, how about all the capabilities that you set from binding while creating the RemoteWebDriver?

    @staticmethod
    def _chrome_options() -> Options:
        opt = Options()
        opt.add_argument("--no-sandbox")
        # incognito disabled. Because in last version of chrome driver we cant disable
        # dialogs for save file in incognito
        # opt.add_argument("--incognito")
        opt.add_argument("--disable-search-engine-choice-screen")
        opt.add_argument("--verbose")
        opt.add_argument("--ignore-certificate-errors")
        opt.add_argument("--start-maximized")
        opt.add_experimental_option("excludeSwitches", ["enable-automation"])
        opt.add_experimental_option("useAutomationExtension", False)
        opt.add_argument("--allow-running-insecure-content")
        opt.add_argument("--disable-dev-shm-usage")
        opt.add_argument("--max-connections=10")
        opt.add_experimental_option('prefs', {
            'profile.default_content_setting_values.automatic_downloads': 1,
            "download.default_directory": pytest.root_dir,  # Change default directory for downloads
            "download.prompt_for_download": False,  # To auto download the file
            "download.directory_upgrade": True,
            "plugins.always_open_pdf_externally": True,
            "plugins.plugins_disabled": ["Chrome PDF Viewer"],
            "safebrowsing.forcedownload_protection_enabled": False,
            "download.extensions_to_open": "application/pdf"
        })
        opt.add_argument("--headless=new")
        opt.page_load_strategy = "eager"
remote_url = "http://chrome:4444"
wd_remote = webdriver.Remote(remote_url, options=self._chrome_options())

@VietND96
Copy link
Member

I feel it could be one of those caps that caused the browser not started properly. To confirm this, can you try a sample run without any options set?

@kisuro
Copy link
Author

kisuro commented Jul 30, 2024

I feel it could be one of those caps that caused the browser not started properly. To confirm this, can you try a sample run without any options set?

Was removed all options except: opt.add_argument("--headless=new")
Result same.
ERROR test/test_routing.py::test_routing - selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes

@VietND96
Copy link
Member

@kisuro, can you check the latest image tag 4.23.1, I suspect that CLI options can be conflicted between SE_OPTS and corresponding env vars, and it is fixed

@kisuro
Copy link
Author

kisuro commented Aug 13, 2024

@kisuro, can you check the latest image tag 4.23.1, I suspect that CLI options can be conflicted between SE_OPTS and corresponding env vars, and it is fixed

Changed Selenium version (requirements.txt):
selenium-4.23.1

updated gitlab-ci.yml lines:

docker:20.10.24

  services:
    - name: selenium/standalone-chrome:latest
      alias: chrome
      variables:
        SE_NODE_OVERRIDE_MAX_SESSIONS: 'true'
        SE_NODE_MAX_SESSIONS: '5'

Result the same :(

E       selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: java.io.IOException: HTTP/1.1 header parser received no bytes 
E       Host info: host: 'c45e83617exx', ip: 'xxx.xx.x.x'
E       Build info: version: '4.23.1', revision: '656257d8e9'
E       System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.12'
E       Driver info: driver.version: unknown
E       Stacktrace:
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:226)
E           at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:71)
E           at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:147)
E           at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:469)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:654)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:573)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:836)
E           at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:793)
E           at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
E           at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
E           at java.lang.Thread.run (Thread.java:840)
/usr/local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:229: SessionNotCreatedException

@vienle197
Copy link

@kisuro I also encountered a similar issue when I set user: root for node-firefox in my docker-compose file. Removing the user: root configuration resolved everything. It's really strange

@kisuro
Copy link
Author

kisuro commented Oct 8, 2024

I still have this problem... Cant find any solution for fix the problem

@kisuro
Copy link
Author

kisuro commented Oct 10, 2024

I still have this problem... Cant find any solution for fix the problem

selenium 4.25.0 (python)
any version higher than selenium/standalone-chrome:123.0
non root user flow investigated: same result

`conftest.py:301:


framework/application.py:88: in init
self.wd = self._get_remote_driver(browser, browser_mode, device_emulation)
framework/application.py:159: in _get_remote_driver
wd_remote = webdriver.Remote(remote_url, options=self._chrome_options(browser_mode, device_emulation))
/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:212: in init
self.start_session(capabilities)
/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:299: in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py:354: in execute
self.error_handler.check_response(response)


self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7faf853d8c50>
response = {'status': 500, 'value': '{\n "value": {\n "error": "session not created",\n "message": "Could not start a new ..."className": "java.lang.Thread",\n "lineNumber": 840,\n "classLoaderName": null\n }\n ]\n }\n}'}
def check_response(self, response: Dict[str, Any]) -> None:
"""Checks that a JSON response from the WebDriver does not have an
error.

    :Args:
     - response - The JSON response from the WebDriver server as a dictionary
       object.

    :Raises: If the response contains an error message.
    """
    status = response.get("status", None)
    if not status or status == ErrorCode.SUCCESS:
        return
    value = None
    message = response.get("message", "")
    screen: str = response.get("screen", "")
    stacktrace = None
    if isinstance(status, int):
        value_json = response.get("value", None)
        if value_json and isinstance(value_json, str):
            import json

            try:
                value = json.loads(value_json)
                if len(value) == 1:
                    value = value["value"]
                status = value.get("error", None)
                if not status:
                    status = value.get("status", ErrorCode.UNKNOWN_ERROR)
                    message = value.get("value") or value.get("message")
                    if not isinstance(message, str):
                        value = message
                        message = message.get("message")
                else:
                    message = value.get("message", None)
            except ValueError:
                pass

    exception_class: Type[WebDriverException]
    e = ErrorCode()
    error_codes = [item for item in dir(e) if not item.startswith("__")]
    for error_code in error_codes:
        error_info = getattr(ErrorCode, error_code)
        if isinstance(error_info, list) and status in error_info:
            exception_class = getattr(ExceptionMapping, error_code, WebDriverException)
            break
    else:
        exception_class = WebDriverException

    if not value:
        value = response["value"]
    if isinstance(value, str):
        raise exception_class(value)
    if message == "" and "message" in value:
        message = value["message"]

    screen = None  # type: ignore[assignment]
    if "screen" in value:
        screen = value["screen"]

    stacktrace = None
    st_value = value.get("stackTrace") or value.get("stacktrace")
    if st_value:
        if isinstance(st_value, str):
            stacktrace = st_value.split("\n")
        else:
            stacktrace = []
            try:
                for frame in st_value:
                    line = frame.get("lineNumber", "")
                    file = frame.get("fileName", "<anonymous>")
                    if line:
                        file = f"{file}:{line}"
                    meth = frame.get("methodName", "<anonymous>")
                    if "className" in frame:
                        meth = f"{frame['className']}.{meth}"
                    msg = "    at %s (%s)"
                    msg = msg % (meth, file)
                    stacktrace.append(msg)
            except TypeError:
                pass
    if exception_class == UnexpectedAlertPresentException:
        alert_text = None
        if "data" in value:
            alert_text = value["data"].get("text")
        elif "alert" in value:
            alert_text = value["alert"].get("text")
        raise exception_class(message, screen, stacktrace, alert_text)  # type: ignore[call-arg]  # mypy is not smart enough here
  raise exception_class(message, screen, stacktrace)

E selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. No nodes support the capabilities in the request
E Host info: host: ***
E Build info: version: '4.25.0', revision: '030fcf7918'
E System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.12'
E Driver info: driver.version: unknown
E Stacktrace:
E at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.checkMatchingSlot (LocalDistributor.java:816)
E at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.run (LocalDistributor.java:798)
E at org.openqa.selenium.concurrent.GuardedRunnable.lambda$guard$0 (GuardedRunnable.java:35)
E at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
E at java.util.concurrent.FutureTask.runAndReset (FutureTask.java:305)
E at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:305)
E at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
E at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
E at java.lang.Thread.run (Thread.java:840)
/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py:229: SessionNotCreatedException
=========================== short test summary info ============================
ERROR test/test_routing.py::test_routing - selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. No nodes support the capabilities in the request
Host info: ***
Build info: version: '4.25.0', revision: '030fcf7918'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-91-generic', java.version: '17.0.12'
Driver info: driver.version: unknown
Stacktrace:
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.checkMatchingSlot (LocalDistributor.java:816)
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.run (LocalDistributor.java:798)
at org.openqa.selenium.concurrent.GuardedRunnable.lambda$guard$0 (GuardedRunnable.java:35)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
at java.util.concurrent.FutureTask.runAndReset (FutureTask.java:305)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:[84]

@VietND96
Copy link
Member

VietND96 commented Oct 11, 2024

ERROR test/test_routing.py::test_routing - selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. No nodes support the capabilities in the request

In your test, any steps set_capability to options is called?
In this case, can you attach logs from Hub/Node which show the request capabilities and current Node capabilities to see which is the not support caps. Or attach the response from Grid endpoint /status, you also can see request caps and Node caps there.

@kisuro
Copy link
Author

kisuro commented Oct 11, 2024

ERROR test/test_routing.py::test_routing - selenium.common.exceptions.SessionNotCreatedException: Message: Could not start a new session. No nodes support the capabilities in the request

In your test, any steps set_capability to options is called? In this case, can you attach logs from Hub/Node which show the request capabilities and current Node capabilities to see which is the not support caps. Or attach the response from Grid endpoint /status, you also can see request caps and Node caps there.

For test was removed all set_capability and 'add_argument' except one : opt.add_argument("--headless=new")
Result the same

Also not used grid "fully" just as service(.gitlab-ci.yml):

  services:
    - name: selenium/standalone-chrome:nightly
      alias: chrome

@VietND96
Copy link
Member

I created a simple reproduce with all options you mentioned reproduce.txt (rename .txt to .py), but could not reproduce. So, you can update this file and send back to us

docker run -p 4444:4444 selenium/standalone-chrome:nightly

$ python3 -m reproduce.py
Options set: {'browserName': 'chrome', 'pageLoadStrategy': 'eager', 'goog:chromeOptions': {'excludeSwitches': ['enable-automation'], 'useAutomationExtension': False, 'prefs': {'profile.default_content_setting_values.automatic_downloads': 1, 'download.default_directory': '/tmp', 'download.prompt_for_download': False, 'download.directory_upgrade': True, 'plugins.always_open_pdf_externally': True, 'plugins.plugins_disabled': ['Chrome PDF Viewer'], 'safebrowsing.forcedownload_protection_enabled': False, 'download.extensions_to_open': 'application/pdf'}, 'extensions': [], 'args': ['--no-sandbox', '--disable-search-engine-choice-screen', '--verbose', '--ignore-certificate-errors', '--start-maximized', '--allow-running-insecure-content', '--disable-dev-shm-usage', '--max-connections=10', '--headless=new']}}
Opened: https://www.google.com/ - Google

@kisuro
Copy link
Author

kisuro commented Oct 14, 2024

I created a simple reproduce with all options you mentioned reproduce.txt (rename .txt to .py), but could not reproduce. So, you can update this file and send back to us

Good afternoon @VietND96, thank you very much for your reply!
Unfortunately I don't have the ability to run docker locally and also have concerns that it might work differently when tested locally.
I took my existing structure from pytest and made it minimal to make it easier to test. I've attached all these files (only changed the file extensions to txt and removed our docker address in gitlab-ci)
Files:

1. dockerfile
2. .gitlab-ci.yml
3. conftest.py
4. framework/application.py
5. test/test-selenium.py

in this configuration everything is reproduced.

  • the test works successfully with chrome-standalone version 123.0 in gitlab-ci.yml , and fails with version 124.0 and higher

I will be very grateful for your help.

Ps. left only two lines in requirements.txt:
selenium
pytest

application.txt
conftest.txt
dockerfile.txt
gitlab-ci.txt
test_selenium.txt

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

No branches or pull requests

5 participants