我们的端到端测试运行在一个码头容器,并使用Webdriver.io -与硒-独立。
自从更新到M1/arm64Mac之后,我一直试图更新测试以运行。
我们的单元测试(jest)通过从使用./google-chrome-stable_current_amd64.deb
改为使用chromium
很容易修复。
测试容器文件:
FROM node:14-bullseye
ENV CHROME_BIN=/usr/bin/chromium
RUN apt-get update \
&& apt-get install -y chromium \
openjdk-11-jre \
xvfb \
x11vnc \
php \
&& mkdir ~/.vnc \
&& x11vnc -storepasswd "fakepwd" ~/.vnc/passwd \
&& rm -rf /var/lib/apt/lists/*
COPY ./entrypoint.sh /usr/local/bin/
ENTRYPOINT ["entrypoint.sh"]
我希望这对于webdriver来说会像以前一样简单,但到目前为止还没有什么好运气。
我已经将@wdio包升级如下:
"@wdio/allure-reporter": "^7.10.1",
"@wdio/cli": "^7.19.3",
"@wdio/devtools-service": "^7.19.3",
"@wdio/junit-reporter": "^7.19.1",
"@wdio/local-runner": "^7.19.3",
"@wdio/mocha-framework": "^7.19.3",
"@wdio/selenium-standalone-service": "^7.19.1",
"@wdio/sync": "^7.19.3",
在锁文件中,我确认了selenium-standalone
版本为7.1。(如前所述,我们使用@wdio服务的7.19.1 -这使用^7.0,但对m1的:https://github.com/webdriverio/selenium-standalone/commit/10e31d0e20444b0f6eb2d897cb3b471782dd243d只使用7.1 )
我已经确认使用了正确的色度驱动程序二进制(在./node_modules/selenium-standalone/.selenium/chromedriver
下是99.0.4844.51-arm64
)
来自wdio.conf.js
services:[['selenium-standalone',{
installArgs: {
drivers: {
chrome: {
binary: '/usr/bin/chromium',
version: chromeDriverVersion,
arch : process.arch,
baseURL : 'https://chromedriver.storage.googleapis.com'
}
}
},
args: {
drivers: {
chrome: {
binary: '/usr/bin/chromium',
version: chromeDriverVersion,
arch : process.arch
}
}
}
}]];
capabilities: [{
browserName: process.env._BROWSER,
acceptInsecureCerts: true,
maxInstances: 4,
'goog:browserOptions': {
binary: '/usr/bin/chromium', // may not be needed, tried anyway
args: process.env._ENABLE_UI === 'false' ?
['--disable-dev-shm-usage','--no-sandbox','--headless','--disable-infobars','--deterministic-fetch', `--window-size=${default_viewport_width},${default_viewport_height}`] :
['--disable-dev-shm-usage','--no-sandbox','--disable-infobars', `--window-size=${default_viewport_width},${default_viewport_height}`]
}
}],
观看wdio日志输出:
2022-04-01T08:09:37.336Z WARN @wdio/utils:shim: You are running tests with @wdio/sync which will be discontinued starting Node.js v16.Read more on https://github.com/webdriverio/webdriverio/discussions/6702
2022-04-01T08:09:40.101Z INFO @wdio/local-runner: Run worker command: run
2022-04-01T08:09:40.124Z DEBUG @wdio/config:ConfigParser: No compiler found, continue without compiling files
2022-04-01T08:09:42.042Z DEBUG @wdio/local-runner:utils: init remote session
2022-04-01T08:09:42.048Z DEBUG @wdio/utils:initialiseServices: initialise service "selenium-standalone" as NPM package
2022-04-01T08:09:42.648Z DEBUG @wdio/sync: Finished to run "beforeSession" hook in 0ms
2022-04-01T08:09:44.535Z DEBUG @wdio/local-runner:utils: init remote session
2022-04-01T08:09:44.536Z INFO webdriver: Initiate new session using the WebDriver protocol
2022-04-01T08:09:44.585Z INFO webdriver: [POST] http://127.0.0.1:4433/wd/hub/session
2022-04-01T08:09:44.586Z INFO webdriver: DATA {
capabilities: {
alwaysMatch: {
browserName: 'chromium',
acceptInsecureCerts: true,
'goog:browserOptions': [Object]
},
firstMatch: [ {} ]
},
desiredCapabilities: {
browserName: 'chromium',
acceptInsecureCerts: true,
'goog:browserOptions': { binary: '/usr/bin/chromium', args: [Array] }
}
}
2022-04-01T08:09:44.600Z ERROR webdriver: RequestError: connect ECONNREFUSED 127.0.0.1:4433
at ClientRequest.<anonymous> (/srv/api/author/node_modules/got/dist/source/core/index.js:956:111)
at Object.onceWrapper (events.js:520:26)
at ClientRequest.emit (events.js:412:35)
at ClientRequest.emit (domain.js:475:12)
at ClientRequest.origin.emit (/srv/api/author/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
at Socket.socketErrorListener (_http_client.js:475:9)
at Socket.emit (events.js:400:28)
at Socket.emit (domain.js:475:12)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16)
2022-04-01T08:09:44.601Z ERROR @wdio/runner: Error: Failed to create session.
Unable to connect to "http://127.0.0.1:4433/wd/hub", make sure browser driver is running on that address.
If you use services like chromedriver see initialiseServices logs above or in wdio.log file as the service might had problems to start the driver.
at startWebDriverSession (/srv/api/author/node_modules/webdriver/build/utils.js:72:15)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Function.newSession (/srv/api/author/node_modules/webdriver/build/index.js:46:45)
at async remote (/srv/api/author/node_modules/@wdio/runner/node_modules/webdriverio/build/index.js:77:22)
at async Runner._startSession (/srv/api/author/node_modules/@wdio/runner/build/index.js:223:56)
at async Runner._initSession (/srv/api/author/node_modules/@wdio/runner/build/index.js:176:25)
at async Runner.run (/srv/api/author/node_modules/@wdio/runner/build/index.js:88:19)
2022-04-01T08:09:44.601Z DEBUG @wdio/sync: Finished to run "after" hook in 0ms
我猜想是铬有问题开始-但我找不到任何相关的日志。
我尝试在容器中手动启动它,但是我不知道这里是否有什么有用的东西:
root@15adddf1e180:/srv/mydir# export DISPLAY=:99
root@15adddf1e180:/srv/mydir# /usr/bin/Xvfb :99 -ac -screen 0 1920x1080x24 > /dev/null 2>&1 &
[1] 9
root@15adddf1e180:/srv/mydir# x11vnc -listen 0.0.0.0 -display :99.0 -usepw -forever -nevershared > /dev/null 2>&1 &
[2] 24
root@15adddf1e180:/srv/mydir# /usr/bin/chromium --no-sandbox
[25:67:0401/081257.532385:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[25:67:0401/081257.532481:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[25:66:0401/081257.540896:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[25:66:0401/081257.540933:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
*** stack smashing detected ***: terminated
*** stack smashing detected ***: terminated
[25:66:0401/081257.571813:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[25:66:0401/081257.571995:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[25:25:0401/081257.619504:ERROR:gpu_process_host.cc(972)] GPU process exited unexpectedly: exit_code=6
*** stack smashing detected ***: terminated
[25:89:0401/081257.630541:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[25:89:0401/081257.631138:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[25:89:0401/081257.631196:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[25:89:0401/081257.631336:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[25:89:0401/081257.631366:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
*** stack smashing detected ***: terminated
*** stack smashing detected ***: terminated
*** stack smashing detected ***: terminated
*** stack smashing detected ***: terminated
[25:25:0401/081257.665149:ERROR:gpu_process_host.cc(972)] GPU process exited unexpectedly: exit_code=6
*** stack smashing detected ***: terminated
*** stack smashing detected ***: terminated
[25:25:0401/081257.679383:ERROR:gpu_process_host.cc(972)] GPU process exited unexpectedly: exit_code=6
*** stack smashing detected ***: terminated
*** stack smashing detected ***: terminated
[25:25:0401/081257.691523:ERROR:gpu_process_host.cc(972)] GPU process exited unexpectedly: exit_code=6
*** stack smashing detected ***: terminated
*** stack smashing detected ***: terminated
[25:25:0401/081257.701605:ERROR:gpu_process_host.cc(972)] GPU process exited unexpectedly: exit_code=6
*** stack smashing detected ***: terminated
*** stack smashing detected ***: terminated
[25:25:0401/081257.705098:ERROR:gpu_process_host.cc(972)] GPU process exited unexpectedly: exit_code=6
[25:25:0401/081257.705122:FATAL:gpu_data_manager_impl_private.cc(447)] GPU process isn't usable. Goodbye.
*** stack smashing detected ***: terminated
[0401/081257.720823:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0401/081257.720915:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Trace/breakpoint trap
root@15adddf1e180:/srv/mydir#
任何帮助都将不胜感激,谢谢!
发布于 2022-08-16 01:08:03
原来“司机”部分必须使用“铬”而不是“铬”。
对于“功能”,它应该是“铬”。
我无法解释为什么不幸的是selenium/webdriver似乎只提到了chrome作为驱动程序,而没有提到it -但这是使它工作的唯一方法。
也就是说。
const drivers = {};
drivers[process.env._BROWSER] = {
binary: '/usr/bin/chromium',
version: chromeDriverVersion,
arch : process.arch,
baseURL : 'https://chromedriver.storage.googleapis.com'
};
services:[['selenium-standalone', {
installArgs: {
drivers: drivers
},
args: {
drivers: drivers
}
}]];
capabilities: [{
browserName: process.env._BROWSER === "chromium" ? "chrome" : process.env._BROWSER,
...
https://stackoverflow.com/questions/71703817
复制相似问题