Drew Resner
Drew Resner

Reputation: 161

The package org.openqa.selenium is accessible from more than one module

I'm using:

The error message is

The package org.openqa.selenium is accessible from more than one module: client.combined, net.bytebuddy"

Screenshot of error

Upvotes: 16

Views: 59846

Answers (8)

user7420004
user7420004

Reputation: 61

The problem is that you are adding .jar files to your Modulepath instead of Classpath.

Go to

  • ProjectBuildPathConfig BuildPath
  • click Remove Jars from Modulepath
  • then click on classpathAdd external selenium jar files

enter image description here

Upvotes: 6

user1276325
user1276325

Reputation: 91

this happens when same java package code (package name + class name) is available in more than one jar file; for default modules every jar is exposed as Module. Modules essentially can not have same package name exported. This is more of a code cleanup task.

Upvotes: 0

BreakTheCode
BreakTheCode

Reputation: 51

Add all the required jar files inside classpath instead of module path. The same issue was also occurred with me but after adding the jars to classpath it got resolved.

Upvotes: 4

Kev
Kev

Reputation: 561

This happens when you have added the external jars in the ModulePath.

Solution:

  1. Remove the external jars from the node "Modulepath".
  2. Select the node "Classpath" then add the external jars.
  3. Review that all the jars are under the node "Classpath".

Upvotes: 44

Sagar
Sagar

Reputation: 41

Add required JAR in class path instead of module path. Also delete unnecessary JARs which might have reference to the mentioned package.

Upvotes: 2

Ertekes Zoltan
Ertekes Zoltan

Reputation: 1

I had the same issue. I used JDK 9 and eclipse oxygen 64-bit version (Selenium 3.9.1). My first thought, it is the JDK 9, but I tested on IntelliJ IDEA JDK 9 and worked without any problem. So I installed the eclipse oxygen 32-bit version with JDK 8 (-no JDK 9 version on 32 bit) and the problem disappeared.

Upvotes: 0

user8879130
user8879130

Reputation: 11

I had the same error and removing the reference to one of the jar files solved the issue. Remove the reference to one of the jar files that you added in java build path.
From the screen shot that you added I see you have reference to both client-combined-3.6.0-sources.jar and client-combined-3.7.0.jar both the packages have the same classes implemented. Remove the reference to one and see if that help.

Upvotes: 1

Sergey
Sergey

Reputation: 1660

I don't know anything about Selenium, but it looks like you have two modules that contain the exact same package name inside of them:

  • client.combined
  • net.bytebuddy

So when you say e.g. import org.openqa.selenium.WebDriver Eclipse doesn't know if you want to use that package from client.combined or from net.bytebuddy.

You need to either add a prefix in that import statement that will specify whether you're importing package org.openqa.selenium from client.combined or from net.bytebuddy.

You can possibly do this by just doing:

  • import client.combined.org.openqa.selenium.WebDriver
  • import client.combined.org.openqa.selenium.firefox.FirefoxDriver

or

  • import net.bytebuddy.org.openqa.selenium.WebDriver
  • import net.bytebuddy.org.openqa.selenium.firefox.FirefoxDriver

You can also try removing either of the packages (client.combined or net.bytebuddy) from your project

Upvotes: 2

Related Questions