2013-03-06 70 views
2

我试图用硒Maven的插件才能使用phantomjs司机从遥控器测试使用的角色枢纽Maven来运行硒服务器,到目前为止我的插件配置是非常简单的:运行硒枢纽行家

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>selenium-maven-plugin</artifactId> 
    <version>2.3</version> 
    <executions> 
    <execution> 
     <id>start-selenium</id> 
     <phase>pre-integration-test</phase> 
     <goals> 
     <goal>start-server</goal> 
     </goals> 
     <configuration> 
     <background>true</background> 
     </configuration> 
    </execution> 

    <execution> 
     <id>stop-seleniump</id> 
     <phase>post-integration-test</phase> 
     <goals> 
     <goal>stop-server</goal> 
     </goals> 
    </execution> 
    </executions> 
</plugin> 

然后我使用maven执行插件钩phantomjs:

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>exec-maven-plugin</artifactId> 
    <version>1.2.1</version> 
    <executions> 
    <execution> 
     <phase>pre-integration-test</phase> 
     <goals> 
     <goal>exec</goal> 
     </goals> 
    </execution> 
    </executions> 
    <configuration> 
    <executable>phantomjs</executable> 
    <arguments> 
     <argument>--webdriver=8080</argument> 
     <argument>--webdriver-selenium-grid-hub=http://localhost:4444</argument> 
    </arguments> 
    </configuration> 
</plugin> 

利用这种结构的输出是:HTTP ERROR: 403 Forbidden for Proxy,我不能再往前走。任何人都已成功配置此?

+0

我决定采取不同的方法来运行phantomjs的硒测试。但是,如果有人能够回答这个问题,那将是非常酷的,因为我认为这可能是一种更有效的处理集成测试的优雅方式。 – jspboix 2013-03-07 09:31:45

回答

0

只要创建一个使用YAJSW(另一个Java服务包装器)来容纳将网格集线器注册为服务的脚本就不会太过分。然后,Maven可以调用脚本并将其作为自己的独立进程启动。此外,Maven可以呼叫停止服务来阻止它。我认为这将是优雅的。

Here is my almost working attempt。我需要征求Selenium专家的帮助才能使其工作。注册意外服务时发生错误。尽管大部分工作都完成了。一旦我得到这个工作,这将是很好的去为你。

现在,虽然可以将Grid Hub作为服务运行,但您不希望对Node执行相同的操作,因为它需要访问桌面(并且服务只能访问自己的隐形私人桌面)。所以,也许这会让我们回到你想要解决的同样的问题。