【问题标题】:How do I get Maven to run Selenium tests in Firefox 3.6?如何让 Maven 在 Firefox 3.6 中运行 Selenium 测试?
【发布时间】:2010-09-02 15:55:48
【问题描述】:

Selenium RC testing with Maven 中部分回答了问题 - 基本上说明回到使用 Firefox 3.5(但一个答案表明这不起作用)。无论如何都不是一个选项 - 我们正在使用 3.6.8。

无论如何,关于如何让 Maven / Selenium 与 Firefox 3.6.x 一起工作的任何线索?

我正在尝试使用:

<dependency>
   <groupId>org.seleniumhq.selenium</groupId>
   <artifactId>selenium</artifactId>
   <version>2.0a5</version>
</dependency>

用于测试中使用的依赖 Java 类。

还有:

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

当我对 Firefox 运行集成测试时,我得到:

INFO [org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher] 正在准备 Firefox 配置文件...

ERROR [org.openqa.selenium.server.BrowserSessionFactory] ​​无法启动新的浏览器会话,关闭浏览器并清除所有会话数据 java.lang.RuntimeException:Firefox 在准备配置文件时拒绝关机

原因: org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$FileLockRemainedException:锁定文件仍然存在! C:\DOCUME~1\XXX\LOCALS~1\Temp\customProfileDirb809d85d6d064be0bdd1a4ee68035cbb\parent.lock 在 org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFileLockToGoAway(FirefoxChromeLauncher.java:269)

【问题讨论】:

  • 这仍然是 Selenium 2.0b3 的问题吗?

标签: firefox maven-2 selenium


【解决方案1】:

我在使用 firefox 和 Selenium RC 时遇到了问题。

解决方案是编辑 selenium RC jar 文件。在 WINRAR(或类似的)中打开它们并浏览文件夹以获取

 selenium-server.jar\customProfileDirCUSTFF\extensions\*
 selenium-server.jar\customProfileDirCUSTFFCHROME\extensions\*

打开你看到的名为“Install.rdf”的文件

    <Description about="urn:mozilla:install-manifest">
        <em:id>readystate@openqa.org</em:id>
        <em:type>2</em:type>
        <em:name>DocumentReadyState</em:name>
        <em:version>1.0</em:version>
        <em:description>Provides a mechanism to update the document readyState property</em:description>

        <!-- Firefox -->
        <em:targetApplication>
            <Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>1.4.1</em:minVersion>
                <em:maxVersion>3.6.*</em:maxVersion>
            </Description>
        </em:targetApplication>
    </Description>
</RDF>

看看它在哪里说 MaxVersion?顶一下,说... 4.6
保存文件并覆盖.jar中原来的install.rdf

那么……selenium 很高兴。

如果这不起作用,我真的很抱歉浪费您的时间。这是我在几个小时/几天的加扰后发现的。

... 编辑 ... 哦 beans 我刚刚从上面阅读了错误消息。远不及同样的问题。您的问题与 lockfile 或以前的 firefox 会话有关。

尝试在浏览器中清除历史记录/重置为出厂默认设置等?

【讨论】:

  • 正如您所怀疑的,更改 maxVesion 对我不起作用。问题与清除历史记录等无关。从 Maven 运行时,Selenium 似乎不支持 Firefox 3.6。
猜你喜欢
  • 2017-02-10
  • 2014-03-12
  • 1970-01-01
  • 1970-01-01
  • 2016-08-07
  • 1970-01-01
  • 2015-08-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多