简体   繁体   中英

Why doesn't Java WebDriver launch Firefox with an updated WebDriver extension?

I'm running into an issue where I attempt to use WebDriver in Java to run some browser tests in Firefox 28. The issue is that Firefox launches fine but instead of getting the first URL, it just hangs on a blank page. After lots of Googling around I came to the conclusion that I needed to update my WebDriver bindings, so I did that.

At this point I've got my Maven dependencies set up to use Webdriver 2.41 on Firefox 28 , which should be compatible .

In fact, when I ran this configuration on Sauce Labs it worked fine. However, it still doesn't work locally. When I look into the Extensions installed in the version of Firefox spun up by WebDriver on my local machine, I see one extension called Firefox WebDriver 2.32.0 with a warning on it that 2.32 is not compatible with Firefox 28.

The same extension on the Sauce Labs Firefox instance is v. 2.39.0 and shows no warning. When I launch Firefox locally, not via WebDriver, I don't see any extension for WebDriver installed at all.

How do I make sure WebDriver launches a version of Firefox with an updated WebDriver extension?

I'm running Win 7 x64. I've tried the same with FF 27, 28, and 29; and WebDriver versions 2.39, 2.40, and 2.41 (imported as Maven dependencies). Using IntelliJ IDEA 13.0.2.

There are a few tidbits online about folks having (unresolved) issues with WebDriver launching a blank page on Firefox. Here are some choice links:

firefox 26 and webdriver 2.39.0 upgradation is not working https://code.google.com/p/selenium/issues/detail?id=7104 https://code.google.com/p/selenium/issues/detail?id=7189

Here's my Maven dependency:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.41.0</version>
</dependency>

I've also tried this with the same result:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>2.41.0</version>
</dependency>

In both cases I checked and selenium-api was installed as well.

Update:

I manually deleted the 2.32 folder from my local .m2 repository and the code wouldn't compile, even though I've got plenty of other versions of WebDriver sitting right there in other folders in the repo. The only way I could get it to work was reset the Maven dependency to 2.32 and re-import so the folder would show up again. Why is it relying on that old version when I want it to use the newest one?

This happened because I had some libraries in my classpath that were not being modified as Maven dependencies, including older versions of the Selenium WebDriver libraries. To resolve it in IntelliJ I did the following:

  • Go to File / Project Structure / Modules
  • Find Selenium .jars that match the version I'm trying to get rid of
  • Use the down arrow to demote these to a position below the WebDriver bindings I am trying to use

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM