org.openqa.selenium包可以从多个模块访问

Dre*_*ner 11 eclipse selenium selenium-webdriver

我正在使用:

  • Firefox 56.0.1
  • 硒3.6.0
  • Windows 10家庭版
  • Gecko Driver 0.19.0

错误消息是

org.openqa.selenium包可以从多个模块访问:client.combined,net.bytebuddy"

错误的屏幕截图

小智 29

在ModulePath中添加外部jar时会发生这种情况.

方案:

  1. 从节点"Modulepath"中删除外部jar.
  2. 选择节点"Classpath",然后添加外部jar.
  3. 检查所有罐子是否在"Classpath"节点下.


小智 6

问题是您将 Jar 文件添加到 Modulepath 而不是 Classpath。转到 Project->BuildPath->Config BuildPath->Remove Jars from Modulepath->然后点击 classpath->Add external selenium jar files。

单击屏幕截图更清晰


Ser*_*gey 2

我对 Selenium 一无所知,但看起来您有两个模块,其中包含完全相同的包名称:

  • 客户组合
  • 网络字节好友

因此,当您说例如import org.openqa.selenium.WebDriverEclipse 不知道您是否想使用来自 的包client.combined还是来自net.bytebuddy.

您需要在该导入语句中添加一个前缀,该前缀将指定您是org.openqa.selenium从导入包client.combined还是从net.bytebuddy.

您可以通过执行以下操作来做到这一点:

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

或者

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

您还可以尝试从项目中删除其中一个包 (client.combined或)net.bytebuddy