Eclipse 我得到了这个错误;无法启动新会话。可能的原因是远程服务器地址无效或浏览器启动失败。”;

Eclipse 我得到了这个错误;无法启动新会话。可能的原因是远程服务器地址无效或浏览器启动失败。”;,eclipse,selenium,testng,Eclipse,Selenium,Testng,执行此代码时,它会为chrome生成一个错误,该错误在等待驱动程序服务器启动时超时 包装 import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class ClassLogin { private WebDriver driver; public void setUp() throws Exception { System.setPrope

执行此代码时,它会为chrome生成一个错误,该错误在等待驱动程序服务器启动时超时

包装

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class ClassLogin {
    private WebDriver driver;
    public void setUp() throws Exception {
    System.setProperty("webdriver.chrome.driver", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");
    driver = new ChromeDriver();
    driver.get("www.xyz.com");
    driver.manage().window().maximize();
    }

}

webdriver.chrome.driver
需要设置为
chromedriver.exe
的路径,而不是
chrome.exe

您可能需要下载,然后适当地设置系统属性