由于我有数百个测试用例要运行,所以我一直试图为我的自动化设置设置并行测试目的设置Selenoid。
这是我尝试过的。
1)安装的码头桌面
2)使用此命令下载的Selenoid容器
docker run -d --name selenoid -p 4444:4444 -v ~/.aerokube/selenoid/:/etc/selenoid/:ro
-v /var/run/docker.sock:/var/run/docker.sock
aerokube/selenoid:latest-release3) Selenoid和Selenoid已在Docker.上启动并运行。为了检查这个设置,我已经这样做了:
当我在浏览器中输入http://localhost:4444/status时,它会带我到一个包含以下文本的页面:
{"total":5,"used":0,"queued":0,"pending":0,"browsers":{}}当我在浏览器中输入http://localhost:8080/时。它带我到带有文本No Sessions yet的Selenoid页面。
我有一个拉铬浏览器图像使用“停靠拉硒/铬”命令。
当我试图自动化一个简单的脚本来访问这个运行在Selenoid容器上的浏览器时,我得到了一个错误。
Requested environment is not available (WARNING: The server did not provide any stacktrace information)
DesiredCapabilities dcap = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
dcap.setCapability(ChromeOptions.CAPABILITY, options);
dcap.setCapability("enableVNC", true);
dcap.setBrowserName("chrome");
RemoteWebDriver driver = new RemoteWebDriver(
URI.create("http://localhost:4444/wd/hub").toURL(),
dcap
);
String driverPath = "C:\\ABC\\chromedriver.exe";
System.setProperty("webdriver.chrome.driver", driverPath);
// Get URL
driver.get("https://www.google.com/");
// Print Title
System.out.println(driver.getTitle()); 我有遗漏什么重要的东西吗?请引导我。谢谢。
发布于 2020-08-26 06:28:13
您至少应该在browsers.json中创建一个~/.aerokube/selenoid/文件,其中Selenoid将读取可用浏览器版本的列表以及要使用的Docker图像。
我建议您使用我们称为cm的自动安装工具,它将完成您的所有操作。将此工具二进制文件下载到工作站安装将非常简单,只需发出两个命令:
$ ./cm selenoid start --vnc
$ ./cm selenoid-ui starthttps://stackoverflow.com/questions/63572285
复制相似问题