gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 07:16:36 24 4
gpt4 key购买 nike

我想通过应用对象存储库概念在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com