Augmenter in combination with selenium/standalone-chrome 4.1.2 - wrong IP

164 views
Skip to first unread message

Peter Schuebl

unread,
Mar 2, 2022, 8:39:00 AM3/2/22
to Selenium Users
Hi,

I"m facing a problem when using standalone-chrome in docker with RemoteWebdriver.

node:
docker run -d -p 4444:4444 --name standalone-chrome -p 7900:7900 --shm-size="2g" -e SE_OPTS="--log-level FINE"  -e SE_NODE_MAX_SESSIONS=10 -eSE_NODE_OVERRIDE_MAX_SESSIONS=true selenium/standalone-chrome:4.1.2

The following code works fine

    ChromeOptions chromeOptions = new ChromeOptions();
    WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/"), chromeOptions);
    driver.get("http://www.example.com");
    System.out.println(driver.getPageSource());

However when I add an Augmenter it starts breaking.

    ChromeOptions chromeOptions = new ChromeOptions();
    WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/"), chromeOptions);
    final WebDriver augmentedDriver = new Augmenter().augment(driver);
    augmentedDriver.get("http://www.example.com");


The request times out because it cannot connect when creating the augmented driver.

Create session returns the docker internal URLs.

Example:
  

During augmenting the webdriver the AndHasCdp functionality tries to use this address which results in the hang.

Is there a way to configure the docker container so that it returns the external visible IP address (http://localhost:4444 in this case) instead of the internal IP4 address of the container? 

Seems like it was introduced in Selenium 4

Is Augmenter still in Beta as the class annotation suggests?

Thanks,
Peter


Peter Schuebl

unread,
Mar 2, 2022, 10:38:56 AM3/2/22
to Selenium Users
Setting SE_NODE_GRID_URL fixes this.
(Didn't work for me before because of a typo)

docker run -d -p 4444:4444 --name standalone-chrome -p 7900:7900 --shm-size="2g" -e SE_OPTS="--log-level FINE"  -e SE_NODE_MAX_SESSIONS=10 -eSE_NODE_OVERRIDE_MAX_SESSIONS=true  -e SE_NODE_GRID_URL="http://127.0.0.1:4444selenium/standalone-chrome:4.1.2

The returned URL is correct now.

Reply all
Reply to author
Forward
0 new messages