我想通过Google Chrome(版本12.0.742.100)上的selenium maven插件(1.1版)进行一些Selenium 2.0 HTML测试,并且出现错误,尝试执行打开命令后,无法调用未定义的的方法'indexOf'。使用Selenium-Maven插件通过谷歌浏览器运行Selenium 2.0 Selenese测试
搜索后,我们似乎应该执行我们的chrome可执行文件,这个参数对于Selenese目标来说并不容易。它看起来像插件允许我们指定chrome可执行文件的文件路径作为Selenium-Maven插件参数的一部分,但它不允许我将- 禁用网络安全添加到电话。如果我尝试这样做,它会发出一个Maven构建错误。
我试图做的是把电话放在一个批处理文件中,然后指向我的POM中的批处理文件,并且工作。然而,最终发生的事情是Chrome浏览器启动并且没有进入测试运行器,它会停留在我的主页上。
我的问题在这里,有无论如何克服了我使用Selenium-Maven插件在Chrome浏览器中通过Selenese测试指出的错误?如果不是,除了将测试转换为JUnits/TestNg测试外,还有什么方法可以解决这个问题。
请看下面我的POM文件的片段。
....
<properties>
<selenium.version>2.0b3</selenium.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>1.1</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium</artifactId>
<version>${selenium.version}</version>
<type>pom</type>
<exclusions>
<!-- prevent ant:ant versus org.apache.ant:ant collision -->
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<executions>
<execution>
<id>Run-googlechrome-Script</id>
<phase>integration-test</phase>
<goals>
<goal>selenese</goal>
</goals>
<configuration>
<browser>*googlechrome</browser>
<suite>src/test/selenium/html/TestSuite.html</suite>
<startURL>http://localhost:5555/</startURL>
<results>${project.build.directory}/results/googlechrome-smoke-results.html</results>
<port>5555</port>
<timeoutInSeconds>5000</timeoutInSeconds>
<multiWindow>true</multiWindow>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
....
感谢,
胡安