这里是最小reproduction
我使用Eclipse Version: 2019-03 M1 (4.11.0 M1)
,Build id: 20190117-2133
有问题的罐子硒,但他们的主要项目中唯一的这是多版本罐子,所以我认为这可能是问题的一部分
基本上,Eclipse有上构建一个错误
selenium.firefox.driver cannot be resolved to a module
并且该模块在类的所有进口将给予错误
The import org.openqa.selenium cannot be resolved
或者它们的一些变化。有时它是org
,它声称不能够解决
重要的是,这样做成功的Maven下编译
您可以使用硒与Java 11才可以从你的module_info.java删除硒和使用它作为一个额外的jar文件。
如果你想使用Selenium作为一个Java模块,你必须编辑你的项目设置,并添加硒你ModulePath进行这样的:
不幸的是,Maven插件似乎是一个Eclipse项目更新(不仅与硒)过程中忽略这一点。
得到这个固定的,我不得不修改module-info.java还有:
module browserAutomation{
requires org.openqa.selenium.core;
requires org.openqa.selenium.firefox;
}
这是对应于在https://github.com/SeleniumHQ/selenium/tree/master/java/client/src/org/openqa/selenium源代码