zoukankan      html  css  js  c++  java
  • selenium无法正常运行 Chrome浏览器,cannot find Chrome binary的问题

    有些同学在运行selenium-chrome时会遇到这个问题,

    System.setProperty("webdriver.chrome.driver","files/chromedriver.exe");
    WebDriver driver = new ChromeDriver();

    看代码,我们并没有什么问题,那如何解决呢?添加一行试一下,

    System.setProperty("webdriver.chrome.driver","files/chromedriver.exe");
    System.setProperty("webdriver.chrome.bin", "C:/Chrome/Application/chrome.exe"); 
    WebDriver driver = new ChromeDriver();

    貌似问题依然存在,那么该如何是好?直接针对Binary来进行修复问题,添加二进制文件地址

    System.setProperty("webdriver.chrome.driver", "files/chromedriver.exe"); 
    ChromeOptions options = new ChromeOptions(); 
    options.setBinary("C:/Chrome/Application/chrome.exe"); 
    ChromeDriver driver = new ChromeDriver(options); 

    如何?

    问题解决了!

  • 相关阅读:
    倒计时功能的实现
    getElementsByClassName
    模拟滚动条
    display:table-cell
    gulp相关知识(2)
    gulp相关知识(1)
    移动端的网页试做
    关于移动端的布局
    伪类before和after
    简单时钟——css3
  • 原文地址:https://www.cnblogs.com/iceb/p/7762030.html
Copyright © 2011-2022 走看看