17

When running synthetic browser tests using Selenium and Google Chrome, we intermittently receive a Selenium error (see below) on a particular website. The flow is:

  1. Load the start page
  2. Enter a search term
  3. Take a screenshot
  4. Click the search button
  5. Take a screenshot of the results

The error occurs during the click action (step 4), but the final screenshot (step 5) contradicts this and shows the search to have been initiated (only possible via a click - some form of auto search is not implemented on the website) and returned results.

Error:

Curl error thrown for http POST to /session/a4ec9662-1841-4809-9680-caf532b243b7/element/2/click
Operation timed out after 30001 milliseconds with 0 bytes received

Stack:

  • Selenium/Chrome Docker container: selenium/standalone-chrome:3.0.1-germanium
  • Facebook PHP WebDriver: see on GitHub
  • Docker PHP: see on GitHub

I have found another post regarding this that suggested to set this environment variable to the docker container: DBUS_SESSION_BUS_ADDRESS=/dev/null, however, this has not worked.

How we manage the container from code:

$Docker = new Docker();
$Manager = $Docker->getContainerManager();
$Container = $Manager->find($container_name);

if ($Container) {
    if ($Container->getState()->getRunning()) {
        // Restart container based on some logic around runtime and usage
    } else {
        $Manager->start($Container->getId());
    }
}

How we handle 'click' actions:

$Element = $this->WebDriverSession->findElement(By::cssSelector($css_selector));
if ($Element->isDisplayed()) {
    $Element->click();
}

EDIT:

I've upgraded our Selenium container to 3.4.0-einsteinium and am still seeing issues.

We have always had issues with some target websites not loading first time and Selenium throwing this error...

Curl error thrown for http POST to /session/cd18695c-bf88-482f-998e-4d8039c22359/url

...we get around this by catching that error and retrying x times before giving up. This update hasn't fixed this either.

yippeykeiyay
  • 171
  • 1
  • 1
  • 6

1 Answers1

3

The same kind of error is reported in docker-selenium issue 163, and seems related to selenium alone.
That is why there now (Aug. 2017) is SeleniumHQ/selenium issue 4384 (now Oct. 2017 closed, as a "performance issue").

That error was also seen in docker-selenium issue 20 (2015) with this comment, more about Chrome crashing:

  • Started in privileged mode:

    docker run --privileged
    
  • Fix small /dev/shm size

    docker exec $id sudo umount /dev/shm
    docker exec $id sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
    

Update End 2017: issue 163 mentions

Maybe there is a bug in supervisord, you can try to bump the version or even go back to an older one.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250