开发者

How do you Configure Selenium Server using selenese command from Maven-Selenium plugin?

开发者 https://www.devze.com 2023-03-14 17:41 出处:网络
I am trying to configure the selenium server that is used by the selenese command by the Maven-Selenium plugin from codehaus. I have tried to create multiple executions within the plugin start the ser

I am trying to configure the selenium server that is used by the selenese command by the Maven-Selenium plugin from codehaus. I have tried to create multiple executions within the plugin start the server in the pre-integration-test phase, which didn't work. The selenium-server simply went into an infinite loop, listening on a port.

I want to know if there is a way to override/configure the selenium-server that the selenese command uses in the plugin. Please let me know.

Please see the POM snippet below.

....
<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-Script</id>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>selenese</goal>
                    </goals>
                    <configuration>
                        <browser>*firefox</browser>
                        <suite>src/test/selenium/html/TestSuite.html</suite>
                        <startURL>http://localhost:4444/</startURL>
                        <results>${project.build.directory}/results/${browser.type}-${test.type}-results.html</results>
                        <port>4444</port>
                        <timeoutInSeconds>${selenium.server.timeout.seconds}</timeoutInSeconds>
                        <multiWindow>${multiple.windows}</multiWindow>
     开发者_如何学编程               </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
....

Thanks,

Juan


Try setting startURL to the url of the application under test instead of pointing to the selenium rc server url. For example, if your selenium test case is clicking a link on google, set startURL to http://www.google.com

Here's a snippet from my pom that's working**

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
        <configuration>
      <browser>*firefox</browser>
      <startURL>http://my-site.com</startURL>
      <suite>test-suite</suite>
      <!-- <logOutput>true</logOutput> -->
      <!-- <timeoutInSeconds>30</timeoutInSeconds> -->
        </configuration>
<executions>
  <execution>
    <id>test</id>
        <phase>test</phase>
        <goals>
      <goal>selenese</goal>
        </goals>
  </execution>
</executions>
  </plugin>

** It works great except that on Mac OS, firefox just stays open and doesn't close?! But, hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消