angular / webdriver-manager

A binary manager for E2E testing
MIT License
224 stars 116 forks source link

Fail to start Webdriver Manager on Docker Image #429

Open 3llen opened 5 years ago

3llen commented 5 years ago

Hello, I try to run my test on our docker image (Alpine) to test our Angular web application with Protector.

In the Dockerfile,

In the terminal, it clearly stated that chromedriver was installed frontend-test_1 | [14:31:15] I/update - chromedriver: unzipping chromedriver_77.0.3865.40.zip . frontend-test_1 | [14:31:15] I/update - chromedriver: setting permissions to 0755 for /usr/src/app/frontend-test/node_modules/webdriver-manager/selenium/chromedriver_77.0.3865.40

Then it said it's unable to find the chromedriver_77.0.3865.40 file in the directory but it was installed a few second ago. frontend-test_1 | 14:31:41.796 ERROR [OsProcess.checkForError] - org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/usr/src/app/frontend-test/node_modules/webdriver-manager/selenium/chromedriver_77.0.3865.40" (in directory "."): error=2, No such file or directory) frontend-test_1 | [14:31:41] E/launcher - Timed out waiting for driver server to start. frontend-test_1 | System info: host: 'b939874db4d1', ip: '172.18.0.10', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.184-linuxkit', java.version: '1.8.0_222' frontend-test_1 | Driver info: driver.version: unknown frontend-test_1 | [14:31:41] E/launcher - WebDriverError: Timed out waiting for driver server to start.

Notice that I use chromium instead of Chrome, is it the cause of the problem? Thank you!

Mathias29 commented 4 years ago

Same problem here for me, please let me know if you found a solution.

AnthonyMastrean commented 4 years ago

This is not the Dockerfile that you'll end up using, but I put it together just to get a good end-to-end reproducible setup.

Dockerfile

FROM node:alpine

RUN apk add --no-cache --update \
        chromium \
        openjdk8-jre \
    && npm install -g webdriver-manager \
    && webdriver-manager update

ENTRYPOINT ["sh", "-c", "webdriver-manager start"]

It seems to work for me.

❯ docker run --rm -it example
webdriver-manager: using global installed version 12.1.7
[16:13:17] I/start - java -Djava.security.egd=file:///dev/./urandom -Dwebdriver.gecko.driver=/usr/local/lib/node_modules/webdriver-manager/selenium/geckodriver-v0.26.0 -Dwebdriver.chrome.driver=/usr/local/lib/node_modules/webdriver-manager/selenium/chromedriver_79.0.3945.36 -jar /usr/local/lib/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar -port 4444
[16:13:17] I/start - seleniumProcess.pid: 16
16:13:18.188 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
16:13:18.340 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2019-12-19 16:13:18.422:INFO::main: Logging initialized @681ms to org.seleniumhq.jetty9.util.log.StdErrLog
16:13:18.834 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
16:13:19.013 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444

Although, my team is now putting together e2e protractor-based tests for an Angular project and they use direct connect, so we don't have to "start" the Selenium server, at all.

ArkadiuszNET commented 4 years ago

I just put installing and updating webdriver into my Dockerfile before chrome install and e2e now works fine now.

# Install webdriver-manager RUN npm install -g webdriver-manager &&\ webdriver-manager update