作为我的项目的一部分,我将整个硒网格捆绑为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。接下来是运行所有Selenium测试的mvn测试。我在这里面临的问题是当我运行maven antrun:run命令时,带有中心和节点启动的seleniun网格。但是我也希望调用Chromedriver.exe,因为我所有的测试都基于ChromeDriver。
我们有什么办法可以模仿以下内容?>
java -Dwebdriver.chrome.driver = C:\ Selenium \ chromedriver.exe -jar%〜dp0 \ selenium-server-standalone.jar-角色中心
在POM中。到目前为止,我相信只有-role hub可以传递到服务器jar,因此,我无法运行任何Selenium测试。作为我的项目的一部分,我将整个硒网格捆绑为Maven捆绑包的一部分。以下是我的POM的外观。