【问题标题】:How do you Configure Selenium Server using selenese command from Maven-Selenium plugin?如何使用 Maven-Selenium 插件中的 selenese 命令配置 Selenium 服务器?
【发布时间】:2011-06-20 22:28:13
【问题描述】:

我正在尝试通过 codehaus 的 Maven-Selenium 插件配置 selenese 命令使用的 selenium 服务器。我试图在插件中创建多个执行,在 pre-integration-test 阶段启动服务器,但没有成功。 selenium-server 只是进入了一个无限循环,监听一个端口。

我想知道是否有办法覆盖/配置 selenese 命令在插件中使用的 selenium-server。请告诉我。

请参阅下面的 POM sn-p。

....
<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>
....

谢谢,

胡安

【问题讨论】:

    标签: maven-2 maven selenium maven-plugin selenium-webdriver


    【解决方案1】:

    尝试将 startURL 设置为被测应用程序的 url,而不是指向 selenium rc 服务器 url。例如,如果您的 selenium 测试用例点击 google 上的链接,请将 startURL 设置为 http://www.google.com

    这是我的 pom 中的一个正在运行的 sn-p **

    <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>
    

    ** 它工作得很好,除了在 Mac OS 上,firefox 只是保持打开而不关闭?!但是,希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多