java.lang.IllegalStateException : The driver executable does not exist chrome driver

标签 java selenium illegalstateexception

我想通过应用对象存储库概念在 Chrome 驱动程序中打开 url。下面给出的是我的 selenium 程序,其中包含两个文件,一个是 testng 文件,另一个是 config.property 文件
chromedriver="E:\\selenium bwosers\\chromedriver.exe" url =“https://www.google.co.in”

我将上面的程序保存为配置文件夹中的config.property

package sele_prac_pkg;

import java.io.File;   
import java.io.FileInputStream;  
import java.util.Properties;  
import org.openqa.selenium.WebDriver;  
import org.openqa.selenium.chrome.ChromeDriver;  
import org.testng.annotations.Test;  

public class Object_repo  
{  
  @Test  
  public void f() throws Exception   
  {  
        File file=new File("./configuration/config.property");  
        FileInputStream fis=new FileInputStream(file);  
        Properties pro=new Properties();  
        pro.load(fis);  
        String url_var=pro.getProperty("url");      
        String chromedriver_var=pro.getProperty("chromedriver");        
        System.setProperty("webdriver.chrome.driver",chromedriver_var);  
        WebDriver driver=new ChromeDriver();   
        driver.get(url_var);  
  }  
}

当我执行上面的代码时,它shwoig java.lang.IllegalStateException:驱动程序可执行文件不存在错误

最佳答案

有两件事

  1. 您不必在属性文件中的值两边加引号
  2. 你确定你给出了正确的路径吗,对我来说,这看起来像是拼写错误selenium bwosers不应该是selenium browsers

关于java.lang.IllegalStateException : The driver executable does not exist chrome driver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38283631/

相关文章:

java - 删除 SQLite 表时出现 IllegalStateException - Android

java - 声明成员类变量并实例化它们

java - java.util.TimerTask 中的 JNDI 查找失败

python - 在 mac OS 上从 python 运行 firefox selenium webdriver 无法启动

c# - 使用 Selenium 选择选项的最快方法?

java - 如果从 Maven 运行,Cucumber 测试结果总是返回 0

android - SQLite 非法状态异常 : where do I close the database?

android - 是什么触发了这个异常实例 : "java.lang.IllegalArgumentException: The observer is null." and how could it be avoid?

java - 变压器配置异常 :Could not compile sytlesheet

java - 委派给抽象基类上的 setter 会导致加载时出现VerifyError