我正在尝试在 Azure Devops 管道中运行 UI 测试,我创建了 yaml 文件并添加了在 chrome 上运行 UItests 的命令,但收到错误“WebDriverError:未知错误:找不到 Chrome 二进制文件” 我正在使用 Node js 代码
这是 YAML 文件:
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
pool:
name: 'Default'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
npm install
npm run build
displayName: 'npm install and build'
- task: Npm@1
inputs:
command: 'install'
customCommand: 'iocContainer'
displayName: 'npm iocContainer'
- task: CmdLine@2
inputs:
script: '.\runUITest.bat "@RecieveOnlineOrder"'
最佳答案
WebDriverError: unknown error: cannot find Chrome binary
问题似乎是 chrome 驱动程序找不到 chrome.exe 文件。
由于您使用的是自托管代理,因此您需要首先确保已在本地计算机上安装 Chrome。如果仅安装了 chrome 驱动程序,您将面临此问题。
您还可以尝试将 Chrome 驱动程序更新到最新。
如果您安装了Chrome,您可以检查chrome.exe的文件路径。
根据 the ChromeDriver - Requirements :
另一方面,这个问题可能与chrome版本有关,这是an open ticket有类似问题的可以引用一下。
您可以尝试运行以下脚本并检查它是否可以工作:
npm i chromedriver --chromedriver_version=LATEST --save-dev
关于node.js - Azure管道中的UI测试显示错误无法使用node js找到chrome二进制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64638097/