问题描述
我正在通过添加硒罐和相关罐创建基本的硒Webdriver程序,下面是我的代码.但是当我尝试解析firefordriver和webdriver导入它们.即时通讯收到导入组织无法解决"错误.
I'm creating a basic selenium Webdriver program by adding the selenium jars and relative jars, below is my code. but when i try to resolve firefordriver and webdriver for importing them. im getting "The import org cannot be resolved" error.
环境详细信息:
Eclipse版本Photon发行版(4.8.0)Build ID:20180619-1200
Eclipse Version Photon Release (4.8.0) Build id: 20180619-1200
Selenium StandAlone服务器3.9.1
Selenium StandAlone server 3.9.1
代码:
package selenium;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class WebDriverBasics {
public static void main(String[] args) {
//1. Firefox browser.
//geckodriver.
System.setProperty("webdriver.gecko.driver","d:\\installations\\eclipse\\jars\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
}
}
推荐答案
删除module-info.java文件或在创建项目时创建的任何其他模块文件.这样可以解决问题.
delete module-info.java file or any other module file that was created at the time of creating the project. That will resolve the issue.
这篇关于“无法解析导入单位"带有硒独立服务器3.9.1的Eclipse Photon中的导入错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!