5

I use the following versions:

  • Selenium - 3.14.0
  • Webdrivermanager - 2.2.4

To create ChromeDriver I use the following configuration:

WebDriverManager.chromedriver()
            .targetPath("/tmp")
            .setup();

    ChromeOptions options = new ChromeOptions();
    options.addArguments("--headless", "--no-sandbox", "--disable-dev-shm-usage");
    options.setBinary("/tmp");

    ChromeDriver driver = new ChromeDriver(options);

When I run my lambda the following exception occurs(from lambda logs):

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /tmp is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Is there a good way to install Chrome browser in AWS Lambda and provide it for ChromeDriver?

Ratmir Asanov
  • 6,237
  • 5
  • 26
  • 40

1 Answers1

0

The method setBinary() of ChromeOptions is supposed to be used to set the path to the Chrome browser. The problem is you are using to set the path where chromedriver (i.e. the binary file required by Selenium WebDriver to communicate with Chrome) is downloaded by WebDriverManager. Therefore, you need to remove that line:

options.setBinary("/tmp");
Boni García
  • 4,618
  • 5
  • 28
  • 44