我想通過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>
....
感謝,
胡安