我有一个正在运行的Selenium Hub,但是我想启动大量Selenium Node来运行它。我正在尝试在PowerShell中执行此操作,但是我并不真正在乎使用哪种工具来完成这项工作。
这样做的命令是
java `-Dwebdriver.chrome.driver="C:\chromedriver.exe" `-jar selenium-server-standalone-3.13.0.jar `-role node `-hub http://localhost:4444/grid/register `-browser "browserName=chrome,version=67,maxInstances=5,seleniumProtocol=WebDriver"
所以我尝试了
start "Title1" java `-Dwebdriver.chrome.driver="C:\chromedriver.exe" `-jar selenium-server-standalone-3.13.0.jar `-role node `-hub http://localhost:4444/grid/register `-browser "browserName=chrome,version=67,maxInstances=5,seleniumProtocol=WebDriver"
start "Title2" java `-Dwebdriver.chrome.driver="C:\chromedriver.exe" `-jar selenium-server-standalone-3.13.0.jar `-role node `-hub http://localhost:4444/grid/register `-browser "browserName=chrome,version=67,maxInstances=5,seleniumProtocol=WebDriver"
这只是在没有启动节点的情况下给了我这个错误
Start-Process : A positional parameter cannot be found that accepts argument '-jar'.
我怀疑问题的一部分是命令中所有各种引号引起的。我也尝试过
$command = `-Dwebdriver.chrome.driver="C:\chromedriver.exe" `-jar selenium-server-standalone-3.13.0.jar `-role node `-hub http://localhost:4444/grid/register `-browser "browserName=chrome,version=67,maxInstances=5,seleniumProtocol=WebDriver"
start "Title1" java $command
start "Title2" java $command
以及该命令的其他不同部分的其他一些变体。
答案 0 :(得分:0)
发件人:Run Multiple Powershell Scripts Sequentially - on a Folder - Combine Scripts into a Master Script
使用任何代码编辑器或文本编辑器简单地创建一个文本文件,并使用以下示例批处理脚本:
start /min powershell.exe C:\your folder\script.ps1
start /min powershell.exe C:\your folder\script.ps1
将其另存为script.bat并将其打开。这将使两个Powershell脚本同时运行。
脚本本身只是读取
cd c:\
java `-Dwebdriver.chrome.driver="C:\chromedriver.exe" `-jar selenium-server-standalone-3.13.0.jar `-role node `-hub http://localhost:4444/grid/register `-browser "browserName=chrome,version=67,maxInstances=5,seleniumProtocol=WebDriver"