SeleniumHQ / docker-selenium

Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation
http://www.selenium.dev/docker-selenium/
Other
7.87k stars 2.51k forks source link

[🐛 Bug]: Latest version of the grid 4.23 not working with Edge tests #2332

Closed d4v1dk0n7 closed 1 month ago

d4v1dk0n7 commented 1 month ago

What happened?

Hi all,

I have updated my docker selenium dynamic grid to the latest version 4.23, and since then the Edge tests are not working (no errors on screen), the tests are simply not starting... With Chrome all is working fine, as always.

If I rollback the Edge image to the previous version 4.22 then all is working fine again. Could you please take a look? Something is wrong here...

Thanks!!

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


version: "3.8"

services:
    vsts_agent:
      build:
        context: .
        dockerfile: docker/Dockerfile.vsts
      image: vsts_agent
      environment:
        - AZP_URL=https://xxxx
        - AZP_TOKEN=xxxx
        - AZP_POOL=xxxx
      volumes:
        - /srv:/srv
      scale: 4
      restart: always

    selenium-hub:
      build:
        context: .
        dockerfile: docker/Dockerfile.hub
      container_name: selenium-hub
      ports:
        - 4442:4442
        - 4443:4443
        - 4444:4444
      environment:
        - SE_SESSION_REQUEST_TIMEOUT=1200
      ulimits:
        nofile: 32768
      restart: always

    node-docker:
      build:
        context: .
        dockerfile: docker/Dockerfile.node-docker
      container_name: node-docker
      shm_size: 2gb
      volumes:
        - ./assets:/opt/selenium/assets
        - ./NodeDocker/config.toml:/opt/bin/config.toml
        - /var/run/docker.sock:/var/run/docker.sock
      depends_on:
        - selenium-hub
      environment:
        - SE_EVENT_BUS_HOST=selenium-hub
        - SE_EVENT_BUS_PUBLISH_PORT=4442
        - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
        - SE_NODE_MAX_SESSIONS=16
        - SE_NODE_SESSION_TIMEOUT=1200
        - SE_OPTS=--session-timeout 1200
        - SE_START_XVFB=false
        - SE_START_VNC=false
      ulimits:
        nofile: 32768
      restart: always

    chrome:
      build:
          context: .
          dockerfile: docker/Dockerfile.chrome
      container_name: chrome
      shm_size: 2gb
      depends_on:
        - selenium-hub
      ulimits:
        nofile: 32768
      restart: always

    edge:
      build:
          context: .
          dockerfile: docker/Dockerfile.edge
      container_name: edge
      shm_size: 2gb
      depends_on:
        - selenium-hub
      ulimits:
        nofile: 32768
      restart: always

    firefox:
      build:
          context: .
          dockerfile: docker/Dockerfile.firefox
      container_name: firefox
      shm_size: 2gb
      depends_on:
        - selenium-hub
      ulimits:
        nofile: 32768
      restart: always

Relevant log output

No errors on screen

Operating System

Ubuntu

Docker Selenium version (image tag)

4.23

Selenium Grid chart version (chart version)

No response

github-actions[bot] commented 1 month ago

@d4v1dk0n7, 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 month ago

Hi, @d4v1dk0n7. 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.

d4v1dk0n7 commented 1 month ago

Hi,

docker-compose added, I don't have more information because the screen is not showing any errors, it keeps stuck trying to start the tests in Edge browser...

d4v1dk0n7 commented 1 month ago

Hello, today I tried again, and (after 10 minutes of waiting), I got this error:

NUnit3TestExecutor discovered 127 of 127 NUnit test cases using Current Discovery mode, Non-Explicit run Setup failed for test fixture company.QA.Test.product.test(company.QA.Domain.Nunit.Context) System.InvalidOperationException : Could not start a new session. Could not start a new session. Unable to create session: Could not start a new session. Response code 500. Message: Could not start a new session. New session request timed out Host info: host: 'b7b8b5afdd5f', ip: '172.18.0.12' Build info: version: '4.23.0', revision: '77010cd' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-117-generic', java.version: '17.0.11' Driver info: driver.version: unknown Build info: version: '4.23.0', revision: '77010cd' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-117-generic', java.version: '17.0.11' Driver info: driver.version: unknown Build info: version: '4.23.0', revision: '77010cd' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-117-generic', java.version: '17.0.11' Driver info: driver.version: unknown Build info: version: '4.23.0', revision: '77010cd' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-117-generic', java.version: '17.0.11' Driver info: driver.version: unknown (SessionNotCreated) StackTrace: at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities) at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities capabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities capabilities, TimeSpan commandTimeout) at company.QA.WebDrivers.RemoteEdgeDriver.get_WebDriver() in /azp/_work/1/s/company.QA.Core/1-Infrastructure/company.QA.WebDrivers/WebDrivers/RemoteEdgeDriver.cs:line 111

This is only happening with Edge image 4.23, with 4.22 is working fine... I assume that this is a problem of the edge driver for linux, because in windows I'm abe to execute edge tests with latest driver...

VietND96 commented 1 month ago

Can you share all capabilities that you set in bindings? Since there is a ticket also reported on edge crashed, however, it is due to wrong methods used in binding https://github.com/SeleniumHQ/selenium/issues/14346

d4v1dk0n7 commented 1 month ago

Hi @VietND96 ,

These are the capabilities we are using with Edge driver:

                var options = new EdgeOptions();
                options.AddArgument("--window-size=1920,1080");
                options.AddArguments("--headless");
                options.SetLoggingPreference(LogType.Browser, LogLevel.All);                   
                webDriver = new RemoteWebDriver(new Uri("http://xxxxx:4444/"), options.ToCapabilities(), TimeOut);

Thanks.

VietND96 commented 1 month ago

Ok, I could see --headless there. I could be related to this https://github.com/SeleniumHQ/selenium/issues/14357 Can you try to change it to --headless=new ?

d4v1dk0n7 commented 1 month ago

Hi,

I've changed the capabilities, now I'm using these:

                options.AddArgument("--window-size=1920,1080");
                options.AddArguments("--headless=new");
                options.AddArguments("--no-sandbox");
                options.AddArguments("--disable-gpu");

Now it's working fine. Thanks!

VietND96 commented 1 month ago

Thanks for your confirmation. We can close this

d4v1dk0n7 commented 3 weeks ago

Hi @VietND96,

I've updated to the new version 4.23.1 of the grid, and I'm getting the same error again, but now the tests are not starting neither in Chrome or Edge... I'm using these capabilities in both:

                options.AddArgument("--window-size=1920,1080");
                options.AddArguments("--headless=new");
                options.AddArguments("--no-sandbox");
                options.AddArguments("--disable-gpu");

Any idea? Thanks!!

d4v1dk0n7 commented 3 weeks ago

After several minutes it throws this exception:

Failed HO01_test [11 m 6 s] Error Message: OneTimeSetUp: System.InvalidOperationException : Could not start a new session. java.io.IOException: HTTP/1.1 header parser received no bytes Host info: host: '2e25b0ac48e4', ip: '172.22.0.2' Build info: version: '4.23.1', revision: '656257d8e9' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-117-generic', java.version: '17.0.12' Driver info: driver.version: unknown (SessionNotCreated) Stack Trace: at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities) at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities capabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities capabilities, TimeSpan commandTimeout) at company.QA.WebDrivers.RemoteEdgeDriver.get_WebDriver() in /azp/_work/1/s/company.QA.Core/1-Infrastructure/company.QA.WebDrivers/WebDrivers/RemoteEdgeDriver.cs:line 114 at company.QA.TestCore.DriverObject.get_WebDriver() in /azp/_work/1/s/company.QA.Core/2-TestCoreServices/company.QA.TestCore/DriverObject.cs:line 27 at company.QA.TestCore.Browser..ctor(TestSession session) in /azp/_work/1/s/company.QA.Core/2-TestCoreServices/company.QA.TestCore/Browser.cs:line 168 at company.QA.TestCore.TestSession..ctor(Context context) in /azp/_work/1/s/company.QA.Core/2-TestCoreServices/company.QA.TestCore/TestSession.cs:line 41

VietND96 commented 3 weeks ago

Via table of versions in release notes https://github.com/SeleniumHQ/docker-selenium/releases Looks like the issue with chromedriver and edgedriver. In tag version 4.23.0, chromedriver is still v126, and now it is aligned with browser v127

VietND96 commented 3 weeks ago

One more thing, in 4.23.1 there is a breaking change on update config.toml path in the container. Please update this line - ./NodeDocker/config.toml:/opt/bin/config.toml to - ./NodeDocker/config.toml:/opt/selenium/config.toml

d4v1dk0n7 commented 3 weeks ago

Hi @VietND96,

Thanks for your help, I've tried these changes but still getting the same error...

VietND96 commented 3 weeks ago

So I don't have any clue else, can you share the full code snippet to create RemoteWebDriver (or executable script) to reproduce?

d4v1dk0n7 commented 3 weeks ago

Sure, this is the code we are using to create driver for chrome:

                var options = new ChromeOptions();
                options.AddArgument("--window-size=1920,1080");
                options.AddArguments("--headless=new");
                options.AddArguments("--no-sandbox");
                options.AddArguments("--disable-gpu");
                options.AddArgument("--disable-search-engine-choice-screen");
                options.PageLoadStrategy = PageLoadStrategy.Eager;
                options.SetLoggingPreference(LogType.Browser, LogLevel.All);                   
                webDriver = new RemoteWebDriver(new Uri("http://server:4444/"), options.ToCapabilities(), TimeOut);
d4v1dk0n7 commented 3 weeks ago

Hi,

I've been doing some tests, I can confirm that with these images the tests are starting:

selenium/standalone-chrome:latest selenium/standalone-edge:latest selenium/standalone-firefox:latest selenium/hub:latest selenium/node-docker:4.23.0

So it seems that the problem has to be with the container selenium/node-docker... When I use the "latest" I get the error.

VietND96 commented 3 weeks ago

@d4v1dk0n7, can you check out the new image tag and confirm the issue is resolved?

d4v1dk0n7 commented 3 weeks ago

@VietND96 I will try ASAP and let you something. Thank you.

d4v1dk0n7 commented 3 weeks ago

Hi @VietND96,

Problem solved, now is working fine. Thanks!!! :)