Issue encountered in Selenium grid 4: Unable to initiate a new session. Potential reasons include an incorrect remote server address or a failure to start the browser

Currently facing an issue while setting up selenium 4 grid using the docker-compose file provided below. The error message "Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure" is being encountered, requiring assistance to resolve.

Docker-compose file:

# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-full-grid.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-full-grid.yml down`
version: "3"
services:
  selenium-event-bus:
    image: selenium/event-bus:4.0.0-20211013
    container_name: selenium-event-bus
    ports:
      - "4442:4442"
      - "4443:4443"
      - "5557:5557"

  selenium-sessions:
    image: selenium/sessions:4.0.0-20211013
    container_name: selenium-sessions
    ports:
      - "5556:5556"
    depends_on:
      - selenium-event-bus
    environment:
      - SE_EVENT_BUS_HOST=selenium-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  ...
  
  chrome:
    image: selenium/node-chrome:4.0.0-20211013
    shm_size: 2gb
    depends_on:
      - selenium-event-bus
    environment:
      - SE_EVENT_BUS_HOST=selenium-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6900:5900"

Run command:

mvn clean install

Executing this command triggers one cucumber test scenario via the test runner specified in testing.xml file.

Setup seems to be nearing completion as indicated by the logs below:

...LOG SNIPPET...

Error logs during test execution:

...ERROR LOGS SNIPPET...

Furthermore, when attempting to access the hub URL, the following message is displayed: https://i.stack.imgur.com/4OWDx.png

The issue pertains to how the remote driver object is initialized:

case CHROME:
            ChromeOptions options = getChromeOptions();
            try {
                driver = new RemoteWebDriver(new URL("http://localhost:4444"), options);
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }

Laptop configuration: Mac m1 512GB

Seeking advice on resolving the encountered issue effectively.

Answer №1

From the latest update on January 20th, 2022, Selenium container images are now being carefully crafted and shared on Docker Hub, supporting armhf, arm64, and amd64 architectures. These versatile multi-arch images have the ability to smoothly operate on all 3 of these diverse platforms.

This breakthrough development opens up new possibilities for developers and testers utilizing Mac M1/M2 aarch64 (arm64) devices, enabling them to effortlessly establish Selenium Grids within Docker. Similarly, it provides a much-needed solution for Raspberry Pi users with compatible armhf (armv7l) architectures.

To access the source code, head over to GitHub and explore the contents of the docker-seleniarm repository, which is a dedicated fork of docker-selenium. Take a look at the README file for comprehensive information.

Kindly note that I am personally responsible for maintaining this particular open-source fork.

Answer №2

In reference to the discussion here regarding this particular issue, it seems that there is currently no support for M1 architecture. Until such support is added, the problem will persist.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I am interested in utilizing Selenium to interact with a hyperlink within an HTML table

I am currently using the code snippet below to fetch data from the HTML structure provided: //findTables(driver); WebElement content = driver.findElement(By.id("tblTaskForms")); List<WebElement> elements = content.findElements(By.className("form-nam ...

Tips for extracting text from a multiline tag using Selenium

I need help extracting the text "1 file has been successfully uploaded" from the code snippet below: <div class="formbuttons"> <h3 id="res" class="demo" style="color: rgb(255, 255, 255); display: block;"> <center>1 file <br>has bee ...

Is it possible to conduct HTML-based Selenium tests without an internet connection?

As a newcomer to Selenium, I am currently using the Selenium IDE which has led me to create table structures like the one below: <table cellspacing="1" cellpadding="1" border="1" name="SELENIUM-TEST"> <thead> <tr class="title"> ...