无法在 Selenium Grid 中 运行 测试在 Maven 设置中引用 Chromedriver.exe

Unable to run tests in Selenium Grid referencing Chromedriver.exe in Maven setup

作为我项目的一部分,我将整个 selenium 网格打包为 Maven 包的一部分。以下是我的 POM 的外观。

<executions>
            <execution>     
                <id>default-cli</id>            
                <phase>pre-integration-test</phase>
                <goals>
                        <goal>run</goal>
                </goals>
                <configuration>
                    <target>
                        <echo message="Helloooooooooooooooooo, maven"/>
                        <java classname="org.openqa.grid.selenium.GridLauncherV3"
                              classpathref="maven.test.classpath"
                              failonerror="true"
                              fork="true">
                            <arg line="-role hub"/>
                        </java>
                        <echo message="END OF TARGET1, maven"/>
                        <java classname="org.openqa.grid.selenium.GridLauncherV3"
                              classpathref="maven.test.classpath"
                              failonerror="true"
                              fork="true">
                            <arg line="-role node
                                       -hub http://localhost:4444/grid/register 
                                       -port 5555"/>
                        </java>
                        <echo message="END OF TARGET2, maven"/>
                    </target>
                </configuration>

                </execution>
            </executions>

所以,我打算做的是执行mvn antrun:run。接下来是 mvn test,其中 运行 是所有 Selenium 测试。我在这里面临的问题是当我 运行 maven antrun:run 命令时,带有集线器和节点的 seleniun 网格启动。但我也希望调用 Chromedriver.exe,因为我所有的测试都基于 ChromeDriver。

我们可以做些什么来模仿以下内容

java -Dwebdriver.chrome.driver=C:\Selenium\chromedriver.exe -jar %~dp0\selenium-server-standalone.jar -role hub 在聚甲醛中。截至目前,我相信只有 -role hub 被传递到服务器 jar,因此我无法 运行 任何 Selenium 测试。

嗯。我正在使用 webdrivermanager 来解决上述问题。非常时尚且易于实施。