WebDriver 无法解析为类型 FirefoxDriver 无法解析为类型 [英] WebDriver cannot be resolved to a type FirefoxDriver cannot be resolved to a type

查看:85
本文介绍了WebDriver 无法解析为类型 FirefoxDriver 无法解析为类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 stackoverflow 上发现了与我类似的错误,并使用以下方法将 selenium webdriver jar 文件添加到项目中:

I found a similar error as mine on stackoverflow and added selenium webdriver jar files to the project using the below method :

右键单击项目--> 转到构建路径--> 配置构建路径--> 单击添加外部jar"--> 从本地机器添加selenium jar 文件--> 单击确定--> 现在鼠标悬停在您的代码中的 WebDriver 上--> 单击导入 webdriver"--现在运行您的代码-->您将摆脱异常.

right click on project--> goto build path--> configure build path--> click on "Add external jars"--> add selenium jar files from your local machine--> click ok--> now mouseover on WebDriver in your code--> click "import webdriver"--now run your code-->you will get rid of the exception.

但是,我仍然收到错误消息.这是错误:

However, I am still getting an error. Here's the error :

线程main"中的异常java.lang.Error:未解决的编译问题:WebDriver 无法解析为类型FirefoxDriver 无法解析为类型

Exception in thread "main" java.lang.Error: Unresolved compilation problems: WebDriver cannot be resolved to a type FirefoxDriver cannot be resolved to a type

推荐答案

当您将 Eclipse 用作 IDE 并尝试运行甚至无法编译的代码时,会发生此错误.在 Eclipse 中检查您的问题视图,并在执行应用程序之前修复编译错误.

This error happens when you use Eclipse as IDE and try to run code that doesn't even compile. Check your Problems view in Eclipse, and fix the compilation errors before executing the application.

这篇关于WebDriver 无法解析为类型 FirefoxDriver 无法解析为类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆