How to test a node app with webdriverio in a dockerized environment (ERR_SSL_PROTOCOL_ERROR) - docker

I want to have three connected docker containers (to run it on a build server):
My application (name: app)
A browser (in this case chrome; name: selenium)
My End2End/UI-Tests (name tester)
However the tests aren't running. The current error message from the tester container is "Request failed with status 500 due to unknown error: net::ERR_SSL_PROTOCOL_ERROR"
file structure:
dir
test
specs
basic.js
app.js
docker-compose.yml
Dockerfile
package.json
wdio.conf.js
And here my files:
"docker-compose.yml":
version: '3'
services:
tester:
build:
context: .
target: e2e-tests
command: npx wdio wdio.conf.js
links:
- selenium
selenium:
image: selenium/standalone-chrome
expose:
- "4444"
links:
- app
app:
build:
context: .
target: prod
expose:
- "3000"
command: npm start
"Dockerfile":
FROM node:12 as base
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
FROM base as prod
COPY app.js ./
EXPOSE 3000
FROM base as e2e-tests
COPY wdio.conf.js ./
COPY test test
"wdio.conf.js":
exports.config = {
hostname: 'selenium',
path: '/wd/hub',
specs: [
'./test/specs/**/*.js'
],
exclude: [],
maxInstances: 10,
capabilities: [{
maxInstances: 5,
browserName: 'chrome',
acceptInsecureCerts: true
}],
logLevel: 'info',
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
framework: 'jasmine',
reporters: ['spec'],
jasmineNodeOpts: {
defaultTimeoutInterval: 60000,
expectationResultHandler: function(passed, assertion) {}
},
}
"test/spec/basic.js":
describe('test app', () => {
it('should have the right title', () => {
browser.url('http://app:3000')
expect(browser).toHaveTextContaining('Hello');
})
})
"app.js":
const express = require('express');
const app = express();
app.get('/', (req, res) => res.send('<html><head><title>Hello</title></head><body>Hello World!</body></html>'));
const server = app.listen(3000, () => {
const { port } = server.address();
console.log(`Test app listening on port ${port}`);
});
"package.json":
{
"name": "wdiodocker",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1"
},
"devDependencies": {
"#wdio/cli": "^6.5.2",
"#wdio/jasmine-framework": "^6.5.0",
"#wdio/local-runner": "^6.5.2",
"#wdio/spec-reporter": "^6.4.7",
"#wdio/sync": "^6.5.0",
"wdio-docker-service": "^3.0.0"
}
}
"bigger snippet from the log":
tester_1 | 2020-09-28T07:55:11.844Z INFO #wdio/cli:launcher: Run onPrepare hook
tester_1 | 2020-09-28T07:55:11.848Z INFO #wdio/cli:launcher: Run onWorkerStart hook
tester_1 | 2020-09-28T07:55:11.850Z INFO #wdio/local-runner: Start worker 0-0 with arg: wdio.conf.js
selenium_1 | 07:55:12.017 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
selenium_1 | 2020-09-28 07:55:12.150:INFO::main: Logging initialized #1038ms to org.seleniumhq.jetty9.util.log.StdErrLog
tester_1 | [0-0] 2020-09-28T07:55:12.634Z INFO #wdio/local-runner: Run worker command: run
tester_1 | [0-0] 2020-09-28T07:55:12.658Z INFO webdriverio: Initiate new session using the ./protocol-stub protocol
selenium_1 | 07:55:12.862 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
tester_1 | [0-0] RUNNING in chrome - /test/specs/basic.js
tester_1 | [0-0] 2020-09-28T07:55:13.056Z INFO webdriverio: Initiate new session using the webdriver protocol
tester_1 | [0-0] 2020-09-28T07:55:13.060Z INFO webdriver: [POST] http://selenium:4444/wd/hub/session
tester_1 | [0-0] 2020-09-28T07:55:13.061Z INFO webdriver: DATA {
tester_1 | capabilities: {
tester_1 | alwaysMatch: { browserName: 'chrome', acceptInsecureCerts: true },
tester_1 | firstMatch: [ {} ]
tester_1 | },
tester_1 | desiredCapabilities: { browserName: 'chrome', acceptInsecureCerts: true }
tester_1 | }
selenium_1 | 07:55:13.122 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
selenium_1 | 07:55:13.331 INFO [ActiveSessionFactory.apply] - Capabilities are: {
selenium_1 | "acceptInsecureCerts": true,
selenium_1 | "browserName": "chrome"
selenium_1 | }
selenium_1 | 07:55:13.335 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
selenium_1 | Starting ChromeDriver 85.0.4183.83 (94abc2237ae0c9a4cb5f035431c8adfb94324633-refs/branch-heads/4183#{#1658}) on port 24508
selenium_1 | Only local connections are allowed.
selenium_1 | Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
selenium_1 | ChromeDriver was started successfully.
selenium_1 | [1601279713.386][SEVERE]: bind() failed: Cannot assign requested address (99)
selenium_1 | 07:55:14.377 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
selenium_1 | 07:55:14.428 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 82d59567606b7f101da8650600e7dd00 (org.openqa.selenium.chrome.ChromeDriverService)
tester_1 | [0-0] 2020-09-28T07:55:14.607Z INFO webdriver: COMMAND navigateTo("http://app:3000/")
tester_1 | [0-0] 2020-09-28T07:55:14.610Z INFO webdriver: [POST] http://selenium:4444/wd/hub/session/82d59567606b7f101da8650600e7dd00/url
tester_1 | [0-0] 2020-09-28T07:55:14.611Z INFO webdriver: DATA { url: 'http://app:3000/' }
tester_1 | [0-0] 2020-09-28T07:55:15.188Z WARN webdriver: Request failed with status 500 due to unknown error: net::ERR_SSL_PROTOCOL_ERROR
tester_1 | (Session info: chrome=85.0.4183.83)
tester_1 | [0-0] 2020-09-28T07:55:15.189Z INFO webdriver: Retrying 1/3
tester_1 | [0-0] 2020-09-28T07:55:15.190Z INFO webdriver: [POST] http://selenium:4444/wd/hub/session/82d59567606b7f101da8650600e7dd00/url
tester_1 | [0-0] 2020-09-28T07:55:15.191Z INFO webdriver: DATA { url: 'http://app:3000/' }
tester_1 | [0-0] 2020-09-28T07:55:15.592Z WARN webdriver: Request failed with status 500 due to unknown error: net::ERR_SSL_PROTOCOL_ERROR
tester_1 | (Session info: chrome=85.0.4183.83)
tester_1 | [0-0] 2020-09-28T07:55:15.592Z INFO webdriver: Retrying 2/3
tester_1 | [0-0] 2020-09-28T07:55:15.594Z INFO webdriver: [POST] http://selenium:4444/wd/hub/session/82d59567606b7f101da8650600e7dd00/url
tester_1 | [0-0] 2020-09-28T07:55:15.595Z INFO webdriver: DATA { url: 'http://app:3000/' }
tester_1 | [0-0] 2020-09-28T07:55:15.942Z WARN webdriver: Request failed with status 500 due to unknown error: net::ERR_SSL_PROTOCOL_ERROR
tester_1 | (Session info: chrome=85.0.4183.83)
tester_1 | [0-0] 2020-09-28T07:55:15.943Z INFO webdriver: Retrying 3/3
tester_1 | [0-0] 2020-09-28T07:55:15.944Z INFO webdriver: [POST] http://selenium:4444/wd/hub/session/82d59567606b7f101da8650600e7dd00/url
tester_1 | [0-0] 2020-09-28T07:55:15.945Z INFO webdriver: DATA { url: 'http://app:3000/' }
tester_1 | [0-0] 2020-09-28T07:55:16.104Z ERROR webdriver: Request failed with status 500 due to unknown error: unknown error: net::ERR_SSL_PROTOCOL_ERROR
tester_1 | (Session info: chrome=85.0.4183.83)
tester_1 | [0-0] Error in "test app should have the right title"
tester_1 | unknown error: unknown error: net::ERR_SSL_PROTOCOL_ERROR
tester_1 | (Session info: chrome=85.0.4183.83)
tester_1 | [0-0] 2020-09-28T07:55:16.118Z INFO webdriver: COMMAND deleteSession()
tester_1 | [0-0] 2020-09-28T07:55:16.119Z INFO webdriver: [DELETE] http://selenium:4444/wd/hub/session/82d59567606b7f101da8650600e7dd00
selenium_1 | 07:55:16.196 INFO [ActiveSessions$1.onStop] - Removing session 82d59567606b7f101da8650600e7dd00 (org.openqa.selenium.chrome.ChromeDriverService)
tester_1 | [0-0] FAILED in chrome - /test/specs/basic.js
tester_1 | 2020-09-28T07:55:16.299Z INFO #wdio/cli:launcher: Run onComplete hook
tester_1 |
tester_1 | "spec" Reporter:
tester_1 | ------------------------------------------------------------------
tester_1 | [chrome 85.0.4183.83 linux #0-0] Spec: /usr/src/app/test/specs/basic.js
tester_1 | [chrome 85.0.4183.83 linux #0-0] Running: chrome (v85.0.4183.83) on linux
tester_1 | [chrome 85.0.4183.83 linux #0-0] Session ID: 82d59567606b7f101da8650600e7dd00
tester_1 | [chrome 85.0.4183.83 linux #0-0]
tester_1 | [chrome 85.0.4183.83 linux #0-0] test app
tester_1 | [chrome 85.0.4183.83 linux #0-0] ✖ should have the right title
tester_1 | [chrome 85.0.4183.83 linux #0-0]
tester_1 | [chrome 85.0.4183.83 linux #0-0] 1 failing (1.6s)
tester_1 | [chrome 85.0.4183.83 linux #0-0]
tester_1 | [chrome 85.0.4183.83 linux #0-0] 1) test app should have the right title
tester_1 | [chrome 85.0.4183.83 linux #0-0] unknown error: unknown error: net::ERR_SSL_PROTOCOL_ERROR
tester_1 | (Session info: chrome=85.0.4183.83)
tester_1 | [chrome 85.0.4183.83 linux #0-0] at <Jasmine>
tester_1 | [chrome 85.0.4183.83 linux #0-0] at processTicksAndRejections (internal/process/task_queues.js:97:5)
tester_1 | [chrome 85.0.4183.83 linux #0-0] at UserContext.<anonymous> (/usr/src/app/test/specs/basic.js:3:17)
Some hints:
when I call curl http://app:3000 from tester or selenium container I receive the HTML as expected.
when I navigate to google in the test, I receive the google code
Thank you for your time!

Related

Webdriver io cucumber test fails to run with invalid argument error

I am new to webdriver io. I ran my cucumber test and it fails with this error
`[0-0] 2023-02-14T21:47:36.064Z WARN webdriver: Request failed with status 400 due to invalid argument: unrecognized capability: pollTimeout
[0-0] 2023-02-14T21:47:36.065Z INFO webdriver: Retrying 1/3
[0-0] 2023-02-14T21:47:36.066Z INFO webdriver: [POST] http://localhost:9515/session
[0-0] 2023-02-14T21:47:36.066Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: {
[0-0] browserName: 'chrome',
[0-0] acceptInsecureCerts: true,
[0-0] pollTimeout: 10000
[0-0] },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: {
[0-0] browserName: 'chrome',
[0-0] acceptInsecureCerts: true,
[0-0] pollTimeout: 10000
[0-0] }
[0-0] }`
Any suggesion on how i can resolve this please?
i tried to comment out waitforTimeout: 10000, in wdio.config.js but it doesnt solve the problem
I solved the problem for myself. I uninstall node and install them with brew to the next version (19.6.0).
After that - 500. Because, chromedriver don`t support Chrome. After that, I updated Google chrome and everything worked.
I install new node version and re-init the wdio, now it work.

appium via command line > Appium/npx wdio/ error

Hello everyone I need your help.
I want to run appium via the command line, but I get constant errors. I suffered for a long time and decided to seek help.
The emulator is installed, the correct apk path, updated all appium versions.
D:\VSC\Webdriverio-appium>npx wdio
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Execution of 1 workers started at 2023-02-13T13:31:11.269Z
2023-02-13T13:31:11.499Z INFO #wdio/cli:launcher: Run onPrepare hook
2023-02-13T13:31:36.561Z INFO #wdio/cli:launcher: Run onWorkerStart hook
2023-02-13T13:31:36.570Z INFO #wdio/local-runner: Start worker 0-0 with arg:
[0-0] 2023-02-13T13:31:42.271Z INFO #wdio/local-runner: Run worker command: run
[0-0] RUNNING in Android - file:///D:/VSC/Webdriverio-appium/test/specs/example.e2e.js
[0-0] 2023-02-13T13:31:43.192Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2023-02-13T13:31:43.772Z INFO webdriver: [POST] http://127.0.0.1:4723/session
[0-0] 2023-02-13T13:31:43.773Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: {
[0-0] platformName: 'Android',
[0-0] 'appium:platformVersion': '11.0',
[0-0] 'appium:automationName': 'UIAutomator2',
[0-0] 'appium:deviceName': 'Pixel 3',
[0-0] 'appium:app': 'D:\\VSC\\Webdriverio-appium\\D:VSCWebdriverio-appiumappAndroidapp.apk'
[0-0] },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: {
[0-0] platformName: 'Android',
[0-0] 'appium:platformVersion': '11.0',
[0-0] 'appium:automationName': 'UIAutomator2',
[0-0] 'appium:deviceName': 'Pixel 3',
[0-0] 'appium:app': 'D:\\VSC\\Webdriverio-appium\\D:VSCWebdriverio-appiumappAndroidapp.apk'
[0-0] }
[0-0] }
[0-0] 2023-02-13T13:31:44.254Z WARN webdriver: Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: The application at 'D:\VSC\Webdriverio-appium\D:VSCWebdriverio-appiumappAndroidapp.apk' does not exist or is not accessible
[0-0] 2023-02-13T13:31:44.255Z INFO webdriver: Retrying 1/3
[0-0] 2023-02-13T13:31:44.257Z INFO webdriver: [POST] http://127.0.0.1:4723/session
[0-0] 2023-02-13T13:31:44.257Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: {
[0-0] platformName: 'Android',
[0-0] 'appium:platformVersion': '11.0',
[0-0] 'appium:automationName': 'UIAutomator2',
[0-0] 'appium:deviceName': 'Pixel 3',
[0-0] 'appium:app': 'D:\\VSC\\Webdriverio-appium\\D:VSCWebdriverio-appiumappAndroidapp.apk'
[0-0] },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: {
[0-0] platformName: 'Android',
[0-0] 'appium:platformVersion': '11.0',
[0-0] 'appium:automationName': 'UIAutomator2',
[0-0] 'appium:deviceName': 'Pixel 3',
[0-0] 'appium:app': 'D:\\VSC\\Webdriverio-appium\\D:VSCWebdriverio-appiumappAndroidapp.apk'
[0-0] }
[0-0] }
[0-0] 2023-02-13T13:31:44.344Z WARN webdriver: Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: The application at 'D:\VSC\Webdriverio-appium\D:VSCWebdriverio-appiumappAndroidapp.apk' does not exist or is not accessible
[0-0] 2023-02-13T13:31:44.345Z INFO webdriver: Retrying 2/3
[0-0] 2023-02-13T13:31:44.345Z INFO webdriver: [POST] http://127.0.0.1:4723/session
[0-0] 2023-02-13T13:31:44.346Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: {
[0-0] platformName: 'Android',
[0-0] 'appium:platformVersion': '11.0',
[0-0] 'appium:automationName': 'UIAutomator2',
[0-0] 'appium:deviceName': 'Pixel 3',
[0-0] 'appium:app': 'D:\\VSC\\Webdriverio-appium\\D:VSCWebdriverio-appiumappAndroidapp.apk'
[0-0] },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: {
[0-0] platformName: 'Android',
[0-0] 'appium:platformVersion': '11.0',
[0-0] 'appium:automationName': 'UIAutomator2',
[0-0] 'appium:deviceName': 'Pixel 3',
[0-0] 'appium:app': 'D:\\VSC\\Webdriverio-appium\\D:VSCWebdriverio-appiumappAndroidapp.apk'
[0-0] }
[0-0] }
[0-0] 2023-02-13T13:31:44.448Z WARN webdriver: Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: The application at 'D:\VSC\Webdriverio-appium\D:VSCWebdriverio-appiumappAndroidapp.apk' does not exist or is not accessible
[0-0] 2023-02-13T13:31:44.448Z INFO webdriver: Retrying 3/3
[0-0] 2023-02-13T13:31:44.449Z INFO webdriver: [POST] http://127.0.0.1:4723/session
[0-0] 2023-02-13T13:31:44.449Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: {
[0-0] platformName: 'Android',
[0-0] 'appium:platformVersion': '11.0',
[0-0] 'appium:automationName': 'UIAutomator2',
[0-0] 'appium:deviceName': 'Pixel 3',
[0-0] 'appium:app': 'D:\\VSC\\Webdriverio-appium\\D:VSCWebdriverio-appiumappAndroidapp.apk'
[0-0] },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: {
[0-0] platformName: 'Android',
[0-0] 'appium:platformVersion': '11.0',
[0-0] 'appium:automationName': 'UIAutomator2',
[0-0] 'appium:deviceName': 'Pixel 3',
[0-0] 'appium:app': 'D:\\VSC\\Webdriverio-appium\\D:VSCWebdriverio-appiumappAndroidapp.apk'
[0-0] }
[0-0] }
[0-0] 2023-02-13T13:31:44.581Z ERROR webdriver: Request failed with status 500 due to unknown error: An unknown server-side error occurred while processing the command. Original error: The application at 'D:\VSC\Webdriverio-appium\D:VSCWebdriverio-appiumappAndroidapp.apk' does not exist or is not accessible
[0-0] 2023-02-13T13:31:44.582Z ERROR webdriver: unknown error: An unknown server-side error occurred while processing the command. Original error: The application at 'D:\VSC\Webdriverio-appium\D:VSCWebdriverio-appiumappAndroidapp.apk' does not exist or is not accessible
[0-0] at getErrorFromResponseBody (file:///D:/VSC/Webdriverio-appium/node_modules/webdriver/build/utils.js:194:12)
[0-0] at NodeJSRequest._request (file:///D:/VSC/Webdriverio-appium/node_modules/webdriver/build/request/index.js:164:23)
[0-0] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[0-0] at startWebDriverSession (file:///D:/VSC/Webdriverio-appium/node_modules/webdriver/build/utils.js:63:20)
[0-0] at Function.newSession (file:///D:/VSC/Webdriverio-appium/node_modules/webdriver/build/index.js:24:45)
[0-0] at remote (file:///D:/VSC/Webdriverio-appium/node_modules/webdriverio/build/index.js:48:22)
[0-0] at Runner._startSession (file:///D:/VSC/Webdriverio-appium/node_modules/#wdio/runner/build/index.js:221:29)
[0-0] at Runner._initSession (file:///D:/VSC/Webdriverio-appium/node_modules/#wdio/runner/build/index.js:187:25)
[0-0] at Runner.run (file:///D:/VSC/Webdriverio-appium/node_modules/#wdio/runner/build/index.js:77:19)
[0-0] 2023-02-13T13:31:44.587Z ERROR #wdio/runner: Error: Failed to create session.
[0-0] An unknown server-side error occurred while processing the command. Original error: The application at 'D:\VSC\Webdriverio-appium\D:VSCWebdriverio-appiumappAndroidapp.apk' does not exist or is not accessible
[0-0] at startWebDriverSession (file:///D:/VSC/Webdriverio-appium/node_modules/webdriver/build/utils.js:68:15)
[0-0] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[0-0] at Function.newSession (file:///D:/VSC/Webdriverio-appium/node_modules/webdriver/build/index.js:24:45)
[0-0] at remote (file:///D:/VSC/Webdriverio-appium/node_modules/webdriverio/build/index.js:48:22)
[0-0] at Runner._startSession (file:///D:/VSC/Webdriverio-appium/node_modules/#wdio/runner/build/index.js:221:29)
[0-0] at Runner._initSession (file:///D:/VSC/Webdriverio-appium/node_modules/#wdio/runner/build/index.js:187:25)
[0-0] at Runner.run (file:///D:/VSC/Webdriverio-appium/node_modules/#wdio/runner/build/index.js:77:19)
[0-0] FAILED in Android - file:///D:/VSC/Webdriverio-appium/test/specs/example.e2e.js
2023-02-13T13:31:44.800Z INFO #wdio/cli:launcher: Run onWorkerEnd hook
2023-02-13T13:31:44.813Z INFO #wdio/cli:launcher: Run onComplete hook
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:33
2023-02-13T13:31:44.826Z INFO #wdio/local-runner: Shutting down spawned worker
2023-02-13T13:31:45.112Z INFO #wdio/local-runner: Waiting for 0 to shut down gracefully
2023-02-13T13:31:45.116Z INFO #wdio/local-runner: shutting down
What to pay attention to. It seems to me that I've double-checked everything. And I don't quite understand what I missed. Thanks

selenium remote hanging in docker

Same as here. docker-compose.yml
version: '3'
services:
db:
image: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=my_app
ports:
- '5432:5432'
chrome:
image: selenium/standalone-chrome
hostname: chrome
privileged: true
shm_size: 2g
web:
build: .
image: my-app
ports:
- "8000:8000"
depends_on:
- db
command: sh -c "python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/code
environment:
- DB_USER=postgres
- DB_PASSWORD=postgres
- DB_HOST=db
- DB_NAME=my_app
everything starts as expected
% docker compose build && docker compose up
[+] Building 3.4s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 189B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for docker.io/library/python:3.11.1-bullseye 3.1s
=> [auth] library/python:pull token for registry-1.docker.io 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 8.58kB 0.0s
=> [1/5] FROM docker.io/library/python:3.11.1-bullseye#sha256:cc4910af48 0.0s
=> CACHED [2/5] COPY requirements.txt requirements.txt 0.0s
=> CACHED [3/5] RUN pip install -r requirements.txt 0.0s
=> CACHED [4/5] COPY . /app 0.0s
=> CACHED [5/5] WORKDIR /app 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:10e58eeb73e4651e1e1aedb921fdde3b389cadc204787 0.0s
=> => naming to docker.io/library/my-app 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[+] Running 3/3
⠿ Container my_app-db-1 Created 0.0s
⠿ Container my_app-chrome-1 Created 0.0s
⠿ Container my_app-web-1 Recreated 0.2s
Attaching to my_app-chrome-1, my_app-db-1, my_app-web-1
my_app-db-1 |
my_app-db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
my_app-db-1 |
my_app-db-1 | 2023-01-08 14:01:28.671 UTC [1] LOG: starting PostgreSQL 15.1 (Debian 15.1-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
my_app-db-1 | 2023-01-08 14:01:28.672 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
my_app-db-1 | 2023-01-08 14:01:28.673 UTC [1] LOG: listening on IPv6 address "::", port 5432
my_app-db-1 | 2023-01-08 14:01:28.688 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
my_app-db-1 | 2023-01-08 14:01:28.699 UTC [28] LOG: database system was shut down at 2023-01-08 13:54:14 UTC
my_app-db-1 | 2023-01-08 14:01:28.720 UTC [1] LOG: database system is ready to accept connections
my_app-chrome-1 | 2023-01-08 14:01:28,791 INFO Included extra file "/etc/supervisor/conf.d/selenium.conf" during parsing
my_app-chrome-1 | 2023-01-08 14:01:28,803 INFO RPC interface 'supervisor' initialized
my_app-chrome-1 | 2023-01-08 14:01:28,803 CRIT Server 'unix_http_server' running without any HTTP authentication checking
my_app-chrome-1 | 2023-01-08 14:01:28,808 INFO supervisord started with pid 8
my_app-chrome-1 | 2023-01-08 14:01:29,811 INFO spawned: 'xvfb' with pid 10
my_app-chrome-1 | 2023-01-08 14:01:29,819 INFO spawned: 'vnc' with pid 11
my_app-chrome-1 | 2023-01-08 14:01:29,833 INFO spawned: 'novnc' with pid 12
my_app-chrome-1 | 2023-01-08 14:01:29,849 INFO spawned: 'selenium-standalone' with pid 14
my_app-chrome-1 | Setting up SE_NODE_GRID_URL...
my_app-chrome-1 | 2023-01-08 14:01:29,911 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1 | 2023-01-08 14:01:29,913 INFO success: vnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1 | 2023-01-08 14:01:29,913 INFO success: novnc entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1 | 2023-01-08 14:01:29,914 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
my_app-chrome-1 | Selenium Grid Standalone configuration:
my_app-chrome-1 | [network]
my_app-chrome-1 | relax-checks = true
my_app-chrome-1 |
my_app-chrome-1 | [node]
my_app-chrome-1 | session-timeout = "300"
my_app-chrome-1 | override-max-sessions = false
my_app-chrome-1 | detect-drivers = false
my_app-chrome-1 | drain-after-session-count = 0
my_app-chrome-1 | max-sessions = 1
my_app-chrome-1 |
my_app-chrome-1 | [[node.driver-configuration]]
my_app-chrome-1 | display-name = "chrome"
my_app-chrome-1 | stereotype = '{"browserName": "chrome", "browserVersion": "108.0", "platformName": "Linux"}'
my_app-chrome-1 | max-sessions = 1
my_app-chrome-1 |
my_app-chrome-1 | Starting Selenium Grid Standalone...
my_app-chrome-1 | Tracing is disabled
my_app-web-1 | Operations to perform:
my_app-web-1 | Apply all migrations: admin, auth, contenttypes, core, sessions
my_app-web-1 | Running migrations:
my_app-web-1 | No migrations to apply.
my_app-web-1 | Watching for file changes with StatReloader
my_app-web-1 | Performing system checks...
my_app-web-1 |
my_app-web-1 | System check identified no issues (0 silenced).
my_app-web-1 | January 08, 2023 - 14:01:33
my_app-web-1 | Django version 4.1.5, using settings 'my_app.settings'
my_app-web-1 | Starting development server at http://0.0.0.0:8000/
my_app-web-1 | Quit the server with CONTROL-C.
my_app-chrome-1 | 14:01:33.430 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
my_app-chrome-1 | 14:01:33.453 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
my_app-chrome-1 | 14:01:35.487 INFO [NodeOptions.getSessionFactories] - Detected 2 available processors
my_app-chrome-1 | 14:01:35.608 INFO [NodeOptions.report] - Adding chrome for {"browserVersion": "108.0","se:noVncPort": 7900,"browserName": "chrome","platformName": "LINUX","se:vncEnabled": true} 1 times
my_app-chrome-1 | 14:01:35.649 INFO [Node.<init>] - Binding additional locator mechanisms: name, relative, id
my_app-chrome-1 | 14:01:35.709 INFO [GridModel.setAvailability] - Switching Node 9f76899f-6574-4e21-9413-d6141aa6c584 (uri: http://172.25.0.2:4444) from DOWN to UP
my_app-chrome-1 | 14:01:35.709 INFO [LocalDistributor.add] - Added node 9f76899f-6574-4e21-9413-d6141aa6c584 at http://172.25.0.2:4444. Health check every 120s
my_app-chrome-1 | 14:01:36.147 INFO [Standalone.execute] - Started Selenium Standalone 4.7.2 (revision 4d4020c3b7): http://172.25.0.2:4444
The logs indicate selenium is currently available at http://172.25.0.2:4444, so I try:
>>> from selenium.webdriver import ChromeOptions, Remote
>>> options = ChromeOptions()
>>> options.add_argument('--headless')
>>> driver = Remote('http://172.25.0.2:4444')
It keeps hanging forever and no special output / log messages / anything further happens, it just keeps hanging until ^c. So how exactly is this supposed to be used? Also for some reason, if the ip address is replaced with http://chrome:4444, the connection is refused.

Why can't I access my web app from a remote container?

I have looked through past answers since this is a common question but no solution seems to work for me.
I have a Springboot Java app and a postgresql database, each in their own container. Both containers run on a remote headless server on a local network. My remote server's physical IP address is 192.168.1.200. When I enter: 'http://192.168.1.200:8080' in my browser from another machine I get a 'unable to connect' response.
Here is my Docker-compose file:
version: "3.3"
services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: aaa
volumes:
- /var/lib/postgresql/data
ports:
- "5432:5432"
networks:
- nat
web:
image: email-viewer
ports:
- "192.168.1.200:8080:80"
depends_on:
- db
networks:
- nat
networks:
nat:
external:
name: nat
Here is the output when I run docker-compose up:
Recreating email-viewer_db_1 ... done
Recreating email-viewer_web_1 ... done
Attaching to email-viewer_db_1, email-viewer_web_1
db_1 |
db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1 |
db_1 | 2022-05-06 16:13:24.300 UTC [1] LOG: starting PostgreSQL 14.2 (Debian 14.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
db_1 | 2022-05-06 16:13:24.300 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2022-05-06 16:13:24.300 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2022-05-06 16:13:24.305 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2022-05-06 16:13:24.311 UTC [27] LOG: database system was shut down at 2022-05-06 13:54:07 UTC
db_1 | 2022-05-06 16:13:24.319 UTC [1] LOG: database system is ready to accept connections
web_1 |
web_1 | . ____ _ __ _ _
web_1 | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
web_1 | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
web_1 | \\/ ___)| |_)| | | | | || (_| | ) ) ) )
web_1 | ' |____| .__|_| |_|_| |_\__, | / / / /
web_1 | =========|_|==============|___/=/_/_/_/
web_1 | :: Spring Boot :: (v2.6.5)
web_1 |
web_1 | 2022-05-06 16:13:25.487 INFO 1 --- [ main] c.a.emailviewer.EmailViewerApplication : Starting EmailViewerApplication v0.0.1-SNAPSHOT using Java 17.0.2 on 1a13d69d117d with PID 1 (/app/email-viewer-0.0.1-SNAPSHOT.jar started by root in /app)
web_1 | 2022-05-06 16:13:25.490 INFO 1 --- [ main] c.a.emailviewer.EmailViewerApplication : No active profile set, falling back to 1 default profile: "default"
web_1 | 2022-05-06 16:13:26.137 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
web_1 | 2022-05-06 16:13:26.184 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 38 ms. Found 1 JPA repository interfaces.
web_1 | 2022-05-06 16:13:26.764 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
web_1 | 2022-05-06 16:13:26.774 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
web_1 | 2022-05-06 16:13:26.775 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.60]
web_1 | 2022-05-06 16:13:26.843 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
web_1 | 2022-05-06 16:13:26.843 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1297 ms
web_1 | 2022-05-06 16:13:27.031 INFO 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
web_1 | 2022-05-06 16:13:27.077 INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.7.Final
web_1 | 2022-05-06 16:13:27.222 INFO 1 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
web_1 | 2022-05-06 16:13:27.313 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
web_1 | 2022-05-06 16:13:27.506 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
web_1 | 2022-05-06 16:13:27.539 INFO 1 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
web_1 | 2022-05-06 16:13:28.034 INFO 1 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
web_1 | 2022-05-06 16:13:28.042 INFO 1 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
web_1 | 2022-05-06 16:13:28.330 WARN 1 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
web_1 | 2022-05-06 16:13:28.663 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
web_1 | 2022-05-06 16:13:28.672 INFO 1 --- [ main] c.a.emailviewer.EmailViewerApplication : Started EmailViewerApplication in 3.615 seconds (JVM running for 4.024)
It turns out that the embedded tomcat server in spring boot uses port 8080 by default and would require 192.168.1.200:8080:8080 instead of 192.168.1.200:8080:80

Running Electron with webdriverio throws chrome not reachable

Has anyone tried working with electron and webdriverio? I am using the latest electron 16 version with "wdio-chromedriver-service": "^7.2.2" and chromedriver "96.0.0" version. I am getting the following error:
$ npx wdio run ./wdio.conf.js --spec welcome-test.e2e.js
Execution of 1 workers started at 2021-11-30T11:14:38.431Z
2021-11-30T11:14:38.516Z INFO #wdio/cli:launcher: Run onPrepare hook
2021-11-30T11:14:38.517Z INFO chromedriver: Start Chromedriver (C:\Projects\abc\node_modules\chromedriver\lib\chromedriver\chromedriver.exe) with args --silent --port=9515 --url-base=/
2021-11-30T11:14:38.652Z INFO #wdio/cli:launcher: Run onWorkerStart hook
2021-11-30T11:14:38.657Z INFO #wdio/local-runner: Start worker 0-0 with arg: run,./wdio.conf.js,--spec,welcome-test.e2e.js
[0-0] 2021-11-30T11:14:39.340Z INFO #wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - C:\Projects\abc\test\specs\welcome-test.e2e.js
[0-0] 2021-11-30T11:14:40.069Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2021-11-30T11:14:40.136Z INFO webdriver: [POST] http://localhost:9515/session
[0-0] 2021-11-30T11:14:40.137Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: {
[0-0] browserName: 'chrome',
[0-0] acceptInsecureCerts: true,
[0-0] 'goog:chromeOptions': [Object]
[0-0] },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: {
[0-0] browserName: 'chrome',
[0-0] acceptInsecureCerts: true,
[0-0] 'goog:chromeOptions': {
[0-0] binary: 'C:/Projects/abc/node_modules/electron/dist/electron.exe',
[0-0] args: [Array]
[0-0] }
[0-0] }
[0-0] }
[0-0] 2021-11-30T11:14:45.557Z WARN webdriver: Request failed with status 500 due to unknown error: Chrome failed to start: exited normally.
[0-0] (chrome not reachable)
[0-0] (The process started from chrome location C:/Projects/abc/node_modules/electron/dist/electron.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
My wdio.conf.js file look like this:
capabilities: [{
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
// grid with only 5 firefox instances available you can make sure that not more than
// 5 instances get started at a time.
maxInstances: 1,
browserName: 'chrome',
acceptInsecureCerts: true,
'goog:chromeOptions': {
binary: 'C:/Projects/abc/node_modules/electron/dist/electron.exe', // Path to your Electron binary.
args: ['app=C:/Projects/abc', '--no-sandbox', '--headless'], // Optional, perhaps 'app=' + /path/to/your/app/
},
// If outputDir is provided WebdriverIO can capture driver session logs
// it is possible to configure which logTypes to include/exclude.
// excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
// excludeDriverLogs: ['bugreport', 'server'],
}],
Any help is appreciated.

Resources