开发者

How do I get Maven to run Selenium tests in Firefox 3.6?

开发者 https://www.devze.com 2023-01-14 11:24 出处:网络
Question partly answered in Selenium RC testing with Maven - basically stating go back to using Firefox 3.5 (but one answer suggesting that does not work). Not an option anyway - 3.6.8 is what we are

Question partly answered in Selenium RC testing with Maven - basically stating go back to using Firefox 3.5 (but one answer suggesting that does not work). Not an option anyway - 3.6.8 is what we are using.

Anyway, any clue on how to get Maven / Selenium working with Firefox 3.6.x?

I am attempting to use:

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

For dependent Java classes used in the tests.

And:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>selenium-maven-plugin</artifactId>
  <version>1.1-SNAPSHOT</version>
  <executions>
    <execution>
      <phase>pr开发者_运维知识库e-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>

When I run integration-test against Firefox, I get:

INFO [org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher] Preparing Firefox profile...

ERROR [org.openqa.selenium.server.BrowserSessionFactory] Failed to start new browser session, shutdown browser and clear all session data java.lang.RuntimeException: Firefox refused shutdown while preparing a profile

Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$FileLockRemainedException: Lock file still present! C:\DOCUME~1\XXX\LOCALS~1\Temp\customProfileDirb809d85d6d064be0bdd1a4ee68035cbb\parent.lock at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFileLockToGoAway(FirefoxChromeLauncher.java:269)


I've had a problem with firefox and Selenium RC.

The solution was to edit the selenium RC jar files. Open them up in WINRAR (or similar) and browse through the folders for

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

Open up the files you see called "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>

And see where it says MaxVersion? Bump that up to say ... 4.6
Save the file and overwrite the original install.rdf in the .jar

Then... selenium is happy.

I really apologise for wating your time if this doesn't work. It was a hack that I found after a few hours / days of scrambling.

... EDIT ... Oh beans I just read the error message from above. Nowhere near the same issue. Yours is something to do with a lockfile or previous firefox session.

Tried a clear history/reset to factory defaults in the browser and similar?

0

精彩评论

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

关注公众号