You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:Selenium中‘WebDriver cannot be resolved to a type’错误解决

WebDriver无法解析为类型的问题排查

无法解决「WebDriver无法解析为类型」错误,已尝试多种方法。

代码示例

package selenium;

public class Test {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.setProperty("webdriver.chrome.driver", "E:\\chromedriver_win32\\chromedriver.exe");
         
         WebDriver driver=new ChromeDriver();
         driver.get("https://www.selenium.dev/downloads/");
         driver.manage().window().maximize();
    }

}

环境配置

  • Java 21
  • Selenium 4.27
  • Eclipse IDE for Java Developers(含孵化组件)版本:2024-12(4.34.0)

相关截图

  • 代码及控制台错误截图:代码及控制台错误截图
  • 导入截图:导入截图
  • 未导入截图:未导入截图
  • 无法启动新会话错误截图:无法启动新会话错误截图

内容的提问来源于stack exchange,提问作者Prakash Mohanraj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 08:37:10