0

I updated POM.xml with latest selenium-java dependency and Browsermob proxy.

Java Code:

   WebDriver driver = new ChromeDriver();
    driver.get("http://www.google.com");
    driver.quit();

POM.xml looks like,

        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>2.53.1</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.1</version>
    </dependency>
    <dependency>
        <groupId>net.lightbody.bmp</groupId>
        <artifactId>browsermob-proxy</artifactId>
        <version>2.0-beta-8</version>
    </dependency>

While I run the automation script, getting the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/HasInputDevices

The script runs fine , after removing Browsermob proxy dependency. ( But I need Browsermob proxy to capture network data).

Looks like the Browsermob proxy has a dependency selenium-api-2.*, I assume that is outdated and causing this problem.

Any help would be greatly appreciated.

Barney
  • 1,584
  • 1
  • 14
  • 31

1 Answers1

1

It looks like you're using a very old version of BrowserMob Proxy, which probably isn't compatible with the latest versions of Selenium.You can find the latest version of BMP on its github page.

For example, the current version of BMP is 2.1.2, so you'd want to include this in your pom file:

<dependency>
    <groupId>net.lightbody.bmp</groupId>
    <!-- note the new artifactId -->
    <artifactId>browsermob-core</artifactId>
    <version>2.1.2</version>
</dependency>
Jason Hoetger
  • 5,650
  • 2
  • 13
  • 14