npx wdio config
我通过with as service尝试了默认安装配置selenium-standalone
,之后作为服务不起作用chromedriver
。这些是我正在运行的命令。
npm init -y
npm install @wdio/cli -y
npx wdio config
npx wdio run wdio.conf.js
控制台日志错误输出。
Failed to connect to selenium. Attempts left: 25
connect ECONNREFUSED 127.0.0.1:4444
2021-12-01T09:07:24.127Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2021-12-01T09:07:24.129Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,wdio.conf.js
[0-0] 2021-12-01T09:07:24.703Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - D:\_code\Node\webdriverio\test\specs\example.e2e.js
[0-0] 2021-12-01T09:07:25.248Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2021-12-01T09:07:25.253Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session
[0-0] 2021-12-01T09:07:25.253Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: { browserName: 'chrome', acceptInsecureCerts: true },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: { browserName: 'chrome', acceptInsecureCerts: true }
[0-0] }
[0-0] 2021-12-01T09:07:27.287Z WARN webdriver: Request failed with status 500 due to Could not start a new session. Error while creating session with the driver service. Stopping drive
r service: Driver server process died prematurely.
我希望它开箱即用,但我得到的只是这些服务/驱动程序错误。
我在 Windows 10 上,已安装 OpenJDK 17.0.1,它已打开path
并JAVA_HOME
已设置。
我可以在<project>\node_modules\selenium-standalone
.
我禁用了防火墙和防病毒软件,但这些不是罪魁祸首。
我想,也许 selenium 服务器没有运行,虽然我希望 wdio 来处理它。所以我用webdriver-manager
.
当我运行时webdriver-manager start
,我可以导航到 http://localhost:4444/wd/hub 并手动创建一个会话,该会话失败并显示此消息(还要注意错误的系统日期 2018)。
UnknownError: Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'WINBLOWZ', ip: '192.168.0.242', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.1'
Driver info: driver.version: unknown
所以第一次尝试,到目前为止体验不佳。欢迎任何建议。