繁体   English   中英

Eclipse 无法找到 chrome 库

[英]Eclipse is not able to find chrome library

我对硒世界很陌生。 我一直坚持使用这个打开基本 facebook 页面的代码,它不断抛出一个错误说:

在端口 8852 上启动 ChromeDriver 78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}) 仅允许本地连接。 请保护 ChromeDriver 及相关测试框架使用的端口,防止恶意代码访问。 线程“main” org.openqa.selenium.WebDriverException 中的异常:未知错误:找不到 Chrome 二进制构建信息:版本:'3.141.59',修订版:'e82be7d358',时间:'2018-11-14T08:25:48 '系统信息:主机:'ATLMD2226268',ip:'10.7.0.108',os.name:'Windows 10',os.arch:'amd64',os.version:'10.0',java.version:'1.8。 0_211'

我使用的代码是:

package NewPackage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class MyClass {
    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "C:\\Users\\vaaggarw\\Downloads\\chromedriver_win32\\chromedriver.exe");
        ChromeOptions options = new ChromeOptions();
        options.setBinary("C:\\Program Files (x86)\\Google Chrome (Local)\\chrome.exe");
        WebDriver driver = new ChromeDriver();
        String baseUrl = "http://www.facebook.com";
        String tagName = "";

        driver.get(baseUrl);
        tagName = driver.findElement(By.id("email")).getTagName();
        System.out.println(tagName);
        driver.close();
        System.exit(0);
}
}
  1. 确保您的项目中没有缺少所有硒罐。 如果仍然不删除它们并从新下载中添加新的 jars
  2. 清理你的项目
  3. 正如 pcalkins 所建议的,正确使用 chrome 选项

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM