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

Eclipse IDE中Selenium源码未找到问题求助

Eclipse中Selenium 4.7.2源码无法查看的问题
  • 已在Eclipse的Java项目中添加Selenium 4.7.2 JAR包
  • 尝试查看源码时,系统提示未附加源文件
  • 搜索到的解决方案是从外部位置添加源码,但对此方案不满意

提示未附加源文件1
提示未附加源文件2

更省心的解决办法

方法1:用构建工具自动关联(推荐)

如果项目用Maven管理,右键项目选「Maven」→「Download Sources」,Eclipse会自动下载并关联对应版本的Selenium源码,不用自己找文件。
要是手动写pom.xml,直接加这个依赖:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.7.2</version>
    <classifier>sources</classifier>
</dependency>

Gradle项目就在build.gradle里加:

dependencies {
    implementation 'org.seleniumhq.selenium:selenium-java:4.7.2'
    implementation sources 'org.seleniumhq.selenium:selenium-java:4.7.2'
}

刷新依赖后,源码自动关联完成。

方法2:手动关联官方源码包

  1. 下载Selenium 4.7.2的源码包(selenium-java-4.7.2-sources.jar)
  2. Eclipse里右键项目→「Build Path」→「Configure Build Path」
  3. 在「Libraries」找到Selenium 4.7.2的JAR,展开后点「Source attachment」→「Edit」
  4. 选择下载好的源码包,确认后就能正常查看源码了

内容的提问来源于stack exchange,提问作者Nambi Rajan

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.08 00:45:33