Siesta Webdriver cannot start chrome on ubuntu docker
Posted: Tue Apr 13, 2021 4:10 pm
by stenjo
Have been trying to find if anyone else has had the same issue, but have had no luck so far.
I'm running unittests in a docker container using a ubuntu image.
Siesta 5.5.1 is installed and seems to be running.
Trying to run tests gives this result:
2021-04-13_15-50-00.png (14.32 KiB) Viewed 7598 times
[ERROR] Setup failed: Error: Can't create first page, runner: a Siesta.Launcher.Runner.WebDriverNodeJS, exception: WebDriverError: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
I know google-chrome is available and runnable - but later changes to chrome does not allow for running headless from root. May this be the cause, or are there other options?
google-chrome --headless
[0413/160831.834003:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
google-chrome --headless --no-sandbox
[0413/160941.923451:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[0413/160941.923835:WARNING:headless_browser_main_parts.cc(83)] Cannot create Pref Service with no user data dir.
Re: Siesta Webdriver cannot start chrome on ubuntu docker
Posted: Tue Apr 13, 2021 4:14 pm
by nickolay
Hi,
It might be possible that there's a mismatch between the installed Chrome and ChromeDriver version. Those versions need to match. Please try downloading the matching version of ChromeDriver from https://chromedriver.chromium.org/ and place the binaries to the /siesta/bin/binary/chromedriver
Re: Siesta Webdriver cannot start chrome on ubuntu docker
Posted: Tue Apr 13, 2021 4:15 pm
by nickolay
You can check the ChromeDriver version with siesta/bin/binary/chromedriver/linux64/chromedriver --version
Re: Siesta Webdriver cannot start chrome on ubuntu docker
Re: Siesta Webdriver cannot start chrome on ubuntu docker
Posted: Tue Apr 13, 2021 4:38 pm
by nickolay
Yes, should be sufficiently equal.
Can you try with puppeteer launcher? If Chrome really fails to start in the container it should also fail..
Perhaps this line is the rootcause:
[0413/160941.923451:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
May be no dbus package in the container?
Re: Siesta Webdriver cannot start chrome on ubuntu docker
root@5f633c56c5e8:/home/pp/wellcom-mono/ProjectPlannerUI# node test.js
(node:260) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
[0413/164606.524645:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/home/pp/wellcom-mono/ProjectPlannerUI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at Interface.helper_js_1.helper.addEventListener (/home/pp/wellcom-mono/ProjectPlannerUI/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)
at Interface.emit (events.js:203:15)
at Interface.close (readline.js:397:8)
at Socket.onend (readline.js:173:10)
at Socket.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:260) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:260) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Re: Siesta Webdriver cannot start chrome on ubuntu docker
Posted: Tue Apr 13, 2021 4:50 pm
by nickolay
Yup, something with the Chrome prerequisites I guess
Re: Siesta Webdriver cannot start chrome on ubuntu docker
Posted: Wed Apr 14, 2021 12:05 pm
by stenjo
In spite of heavy googling, I have not been successful in solving the issue with dbus. Might be some chrome prerequisites, but really difficult to debug (that is: have had no success).
Your suggestion on running puppeteer inspired me to try that path as well:
Running in github actions:
##[debug]Loading env
Run chmod a+x ../sdk/siesta/bin/puppeteer
chmod a+x ../sdk/siesta/bin/puppeteer
chmod a+x ../sdk/siesta/bin/binary/nodejs/linux64/node
# ../sdk/siesta/bin/puppeteer https://127.0.0.1:80/tests/unittests-no-ui.html?onserver=1 --browser chrome --pause 0 --headless
../sdk/siesta/bin/puppeteer https://127.0.0.1:80/tests/unittests-no-ui.html
shell: /usr/bin/bash -e {0}
env:
TEST_BASE_URL: https://127.0.0.1:80
SENCHA_CMD_V: 7.3.0.19
_JAVA_OPTIONS: -Xms512m -Xmx1512m -XX:-UseGCOverheadLimit
JAVA_HOME: /opt/hostedtoolcache/Java_Zulu_jdk/12.0.2-3/x64
##[debug]Overwrite 'working-directory' base on job defaults.
##[debug]/usr/bin/bash -e /home/runner/work/_temp/9bb84811-2ae1-4c60-86dd-09600661ee06.sh
[ERROR] The project page you are targeting contains Siesta Lite distribution. To use automation facilities,
make sure project page uses `siesta-all.js` from Standard or Trial packages
[ERROR] Setup failed: Error: Error while opening project page: 5
Error: Process completed with exit code 5.
##[debug]Finishing: Run tests on SchedulerUI
Have tried to find out of this error - what does it mean?
Re: Siesta Webdriver cannot start chrome on ubuntu docker
Posted: Wed Apr 14, 2021 12:10 pm
by nickolay
Hm.. Perhaps you could start with some docker container that already has Chrome? May be there's "official" container for Chrome?
Anyway, this error means that the project web page https://127.0.0.1:80/tests/unittests-no-ui.html contains a Siesta version w/o the automation package (Siesta Lite). Need to make sure the project web page and the launcher binary uses the same Siesta package.
Re: Siesta Webdriver cannot start chrome on ubuntu docker
Posted: Thu Jun 24, 2021 9:07 am
by stenjo
We've managed to run the siesta unit tests in a github workflow using the below script.
This serves as a first check on any pull-requests we create that modifies any of the sencha-based code.
To make this work we have all the siesta files checked stored in a common "sdk" directory that is checked out together with the code to be tested. Then we install Node, Java and installs sencha command (created a simple action to do that). Part of this workflow is to run jshint before the tests are run using puppeteer after starting a local webserver.
There is most certainly simplifications possible, but for us, this works like charm.
For others benefit, I leave a simplified script here:
jobs:
build:
runs-on: ubuntu-latest
env:
TEST_BASE_URL: localhost:80
_JAVA_OPTIONS: -Xms512m -Xmx1512m -XX:-UseGCOverheadLimit
SDK_PATH: /home/runner/work/wellcom-mono/wellcom-mono/sdk
BUILD_PATH: ProjectPlannerUI
TEST_PATH: tests
steps:
- name: Use Java 12 - zulu distro
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '12'
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Chekcout ${{ env.BUILD_PATH }}/ and sdk/
run: |
*** sparse checkout of both the sdk folder and the code to be tested ***
- uses: equinor/sencha-cmd@v1
- name: Lint ${{ env.BUILD_PATH }}/app
working-directory: ./${{ env.BUILD_PATH }}
run: |
npm install jshint --save-dev
./node_modules/jshint/bin/jshint app/
- name: Build app
working-directory: ./${{ env.BUILD_PATH }}
run: sencha app build
- name: Set up webserver
working-directory: ./${{ env.BUILD_PATH }}
run: |
sudo cp -R ./* /var/www/html
sudo service apache2 restart
curl $TEST_BASE_URL/${{env.TEST_PATH}}/unittests-no-ui.html
- name: Run tests on ${{ env.BUILD_PATH }}
working-directory: ./${{ env.BUILD_PATH }}
run: |
${{ env.SDK_PATH}}/siesta/bin/puppeteer ${{ env.TEST_BASE_URL}}/${{env.TEST_PATH}}/unittests-no-ui.html?onserver=1 --max-workers 4