Chrome浏览器在WebdriverIO中无法打开。

huangapple go评论54阅读模式
英文:

chrome browser not opening in webdriverio

问题

以下是您提供的文本的中文翻译:

我是一名新手,尝试了YouTube上的Webdriverio教程,但它不起作用,存在配置或设置的问题,无法理解。

编写了一个简单的启动浏览器的程序。

尝试了所有选项,但Chrome浏览器没有启动。

这是输出:

PS C:\Users\User\OneDrive\Documents\Webdriver-io-examples> npx wdio run .\wdio.conf.js

1个工作进程的执行于2023-04-06T21:06:17.713Z开始

2023-04-06T21:06:17.867Z INFO chromedriver:启动Chromedriver Launcher(v8.1.1)
2023-04-06T21:06:17.869Z INFO @wdio/cli:launcher:运行onPrepare挂钩
2023-04-06T21:06:17.877Z INFO chromedriver:使用参数启动Chromedriver(C:\Users\User\OneDrive\Documents\Webdriver-io-examples\node_modules\chromedriver\lib\chromedriver\chromedriver.exe)--port=9515 --url-base=/
2023-04-06T21:06:25.576Z INFO chromedriver:在端口9515上启动ChromeDriver 112.0.5615.49(bd2a7bcb881c11e8cfe3078709382934e3916914-refs/branch-heads/5615@{#936})
2023-04-06T21:06:25.577Z INFO chromedriver:仅允许本地连接。
2023-04-06T21:06:25.578Z INFO chromedriver:请参阅https://chromedriver.chromium.org/security-considerations以获取有关保持ChromeDriver安全的建议。
2023-04-06T21:06:25.597Z INFO chromedriver:ChromeDriver已成功启动。
2023-04-06T21:06:25.638Z INFO @wdio/cli:launcher:运行onWorkerStart挂钩
2023-04-06T21:06:25.642Z INFO @wdio/local-runner:使用参数启动工作进程0-0:run, .\wdio.conf.js
[0-0] 错误:“ts-node/esm/transpile-only 'resolve'”未在其链中调用下一个挂钩,也未明确表示应用了short[0-0]     在node:internal/errors:399:5处新建NodeError
[0-0]     在node:internal/modules/esm/loader:846:13处解析ESMLoader
[0-0]     在node:internal/modules/esm/loader:424:7处获取ESMLoader.getModuleJob
[0-0] 失败
2023-04-06T21:06:26.287Z INFO @wdio/cli:launcher:运行onWorkerEnd挂钩
2023-04-06T21:06:26.288Z INFO @wdio/cli:launcher:运行onComplete挂钩

规范文件:已通过0个,失败1个,共1个(100%在00:00:08内完成)

2023-04-06T21:06:26.294Z INFO @wdio/local-runner:关闭已生成的工作进程
2023-04-06T21:06:26.547Z INFO @wdio/local-runner:等待0个进程正常关闭
2023-04-06T21:06:26.549Z INFO @wdio/local-runner:关闭

Package.json

{
  "name": "webdriver-io-examples",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "wdio": "wdio run ./wdio.conf.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@wdio/cli": "^8.7.0",
    "@wdio/local-runner": "^8.7.0",
    "@wdio/mocha-framework": "^8.7.0",
    "@wdio/spec-reporter": "^8.7.0",
    "chromedriver": "^112.0.0",
    "wdio-chromedriver-service": "^8.1.1"
  }
}
英文:

i am a new learner, tried the Webdriverio tutorial from youtube, but it's not working
the issue with configuration or setup, not able to understand,

Wrote a Simple program of launching a browser

Tried all the options but the Chrome browser is not launching,

This is the output:

PS C:\Users\User\OneDrive\Documents\Webdriver-io-examples> npx wdio run .\wdio.conf.js

Execution of 1 workers started at 2023-04-06T21:06:17.713Z

2023-04-06T21:06:17.867Z INFO chromedriver: Initiate Chromedriver Launcher (v8.1.1)
2023-04-06T21:06:17.869Z INFO @wdio/cli:launcher: Run onPrepare hook
2023-04-06T21:06:17.877Z INFO chromedriver: Start Chromedriver (C:\Users\User\OneDrive\Documents\Webdriver-io-examples\node_modules\chromedriver\lib\chromedriver\chromedriver.exe) with args --port=9515 --url-base=/
2023-04-06T21:06:25.576Z INFO chromedriver: Starting ChromeDriver 112.0.5615.49 (bd2a7bcb881c11e8cfe3078709382934e3916914-refs/branch-heads/5615@{#936}) on port 9515
2023-04-06T21:06:25.577Z INFO chromedriver: Only local connections are allowed.
2023-04-06T21:06:25.578Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for 
suggestions on keeping ChromeDriver safe.
2023-04-06T21:06:25.597Z INFO chromedriver: ChromeDriver was started successfully.
2023-04-06T21:06:25.638Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2023-04-06T21:06:25.642Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,.\wdio.conf.js
[0-0] Error: "ts-node/esm/transpile-only 'resolve'" did not call the next hook in its chain and did not explicitly signal a shor[0-0]     at new NodeError (node:internal/errors:399:5)
[0-0]     at ESMLoader.resolve (node:internal/modules/esm/loader:846:13)
[0-0]     at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:7)
[0-0] FAILED
2023-04-06T21:06:26.287Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2023-04-06T21:06:26.288Z INFO @wdio/cli:launcher: Run onComplete hook

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:08

2023-04-06T21:06:26.294Z INFO @wdio/local-runner: Shutting down spawned worker
2023-04-06T21:06:26.547Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2023-04-06T21:06:26.549Z INFO @wdio/local-runner: shutting down

Chrome浏览器在WebdriverIO中无法打开。

Package.json

{
  "name": "webdriver-io-examples",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "wdio": "wdio run ./wdio.conf.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@wdio/cli": "^8.7.0",
    "@wdio/local-runner": "^8.7.0",
    "@wdio/mocha-framework": "^8.7.0",
    "@wdio/spec-reporter": "^8.7.0",
    "chromedriver": "^112.0.0",
    "wdio-chromedriver-service": "^8.1.1"
  }
}

答案1

得分: 0

出现了Webdriverio程序执行错误。您提供的输出显示Chromedriver已成功启动,但随后出现了以下错误消息:

[0-0] 错误:“ts-node/esm/transpile-only 'resolve'”未在其链中调用下一个钩子,也未明确表示短[0-0] 在新的NodeError(node:internal/errors:399:5)处
[0-0] 在ESMLoader.resolve(node:internal/modules/esm/loader:846:13)处
[0-0] 在ESMLoader.getModuleJob(node:internal/modules/esm/loader:424:7)处

此错误消息表明TypeScript转译器存在问题。可能是您的配置或设置引发了此错误。

没有看到您的代码和配置文件,很难提供如何解决此问题的具体建议。但是,您可以尝试以下一些一般的故障排除步骤:

  1. 检查配置文件:确保wdio.conf.js文件已正确配置,并且所有必要的设置都已完成。您可以将配置文件与正常工作的示例进行比较,以查看是否存在任何差异。

  2. 检查依赖项:确保已安装并更新了所有必要的依赖项。您可以在项目目录中运行npm install来执行此操作。

  3. 尝试运行不同的示例:如果您在特定示例上遇到问题,请尝试运行不同的示例以查看问题是否仍然存在。这可以帮助您确定问题是与配置还是示例代码本身有关。

英文:

It looks like there was an error with the execution of your Webdriverio program. The output you provided shows that Chromedriver was successfully started, but then an error occurred with the following message:

[0-0] Error: "ts-node/esm/transpile-only 'resolve'" did not call the next hook in its chain and did not explicitly signal a shor[0-0] at new NodeError (node:internal/errors:399:5)
[0-0] at ESMLoader.resolve (node:internal/modules/esm/loader:846:13)
[0-0] at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:7)

This error message indicates that there was a problem with the TypeScript transpiler. It's possible that there is an issue with your configuration or setup that is causing this error.

Without seeing your code and configuration files, it's difficult to provide specific advice on how to resolve this issue. However, here are a few general troubleshooting steps you can try:

Check your configuration file: Make sure that your wdio.conf.js file is properly configured and that all the necessary settings are in place. You may want to compare your configuration file to a working example to see if there are any differences.

Check your dependencies: Make sure that all the necessary dependencies are installed and up-to-date. You can do this by running npm install in your project directory.

Try running a different example: If you're having trouble with a specific example, try running a different one to see if the problem persists. This can help you determine if the issue is with your configuration or with the example code itself.

huangapple
  • 本文由 发表于 2023年4月7日 05:30:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/75953935.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定