0

I am trying to use Selenium and PhantomJS in a Maven & Java Project.

Here are the dependencies I use in my pom.xml file:

<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-server-standalone</artifactId>
      <version>2.53.0</version>
      <scope>test</scope>
    </dependency>

    <dependency>
       <groupId>io.github.bonigarcia</groupId>
       <artifactId>webdrivermanager</artifactId>
       <version>1.4.5</version>
       <scope>test</scope>
    </dependency>
</dependencies>

<repositories>
      <repository>
        <id>jenkins-releases</id>
        <url>http://repo.jenkins-ci.org/releases/</url>
      </repository>
</repositories>`

In my Java file, I am trying to set up PhantomJS driver without having the JAR file on my computer, using this method :

public void set_up(){
    PhantomJsDriverManager.getInstance().setup();

    // Configuration du driver
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setJavascriptEnabled(true);
    driver = new PhantomJSDriver(capabilities);
 }

When I first tried this, it worked well but since a week or two, I am getting this error :

java.lang.RuntimeException: org.openqa.selenium.NoSuchElementException: Unable to locate element with ID: available-downloads
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Driver info: driver.version: HtmlUnitDriver
at io.github.bonigarcia.wdm.BrowserManager.manage(BrowserManager.java:272)
at io.github.bonigarcia.wdm.BrowserManager.setup(BrowserManager.java:103)
at io.github.bonigarcia.wdm.BrowserManager.setup(BrowserManager.java:82)

Does anybody have an idea of what to modify? I am lost and don't know what to do...

Eddie
  • 9,696
  • 4
  • 45
  • 58
Laura G
  • 165
  • 14

1 Answers1

5

Just found out that a change had been done on the webdrivermanager.

For people who have the same problem, just update the version of your webdrivermanager groupId to the 1.4.7 version.

More information on https://github.com/bonigarcia/webdrivermanager

Laura G
  • 165
  • 14
  • That solved it? I'm surprised, the error doesn't seem to be connected to the setup. – Rafael Almeida Aug 02 '16 at 13:29
  • Yes it was :) "Unable to locate element with ID: available-downloads" corresponded to the setup() configuration done when executing "PhantomJsDriverManager.getInstance().setup();" – Laura G Aug 02 '16 at 13:46