sách gpt4 ai đã đi

java - 通过 powershell 启动 selenium grid hub 时出错 - VSTS/TFS

In lại 作者:行者123 更新时间:2023-12-02 13:10:06 26 4
mua khóa gpt4 Nike

由于出现以下错误,我正在努力通过构建中的 powershell 脚本在 azure VM 上启动 selenium grid....

System.Management.Automation.RuntimeException: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Error: Unable to access jarfile selenium-server-standalone-3.4.0.jar

该脚本仅包含java -jar selenium-server-standalone-3.4.0.jar -role hub并且它在本地运行良好。 Java 安装在虚拟机上。

有人知道问题出在哪里吗?

Cảm ơn

1 Câu trả lời

根据您提供的脚本,我怀疑您将powershell脚本文件与“selenium-server-standalone-3.4.0.jar”放在同一文件夹中,因此您不需要指定jar文件的路径在脚本中。但是,当您从远程运行脚本时,由于工作文件夹已更改,您需要使用“selenium-server-standalone-3.4.0.jar”文件的绝对路径。添加文件的绝对路径或在脚本文件中添加“Set-Location”命令将文件夹设置为jar文件放置的路径,然后重试。

顺便说一句,如果您只是从 powershell 脚本中调用“java -jar selenium-server-standalone-3.4.0.jar -role hub”命令,您将继续等待远程 PowerShell 脚本步骤,因为 powershell由于 selenium 服务器持续运行,脚本无法完成。我建议您启动另一个进程来运行 selenium 服务器,如下所示:

Set-Location JarFileFolderPath
Start-Job -ScriptBlock {cmd /c start java -jar selenium-server-standalone-3.4.0.jar -role hub}

并确保在所有测试完成后停止作业。

关于java - 通过 powershell 启动 selenium grid hub 时出错 - VSTS/TFS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43989472/

26 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com