解决selemium报错 Could not start a new session. Possible causes are invalid address of the remote server

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决selemium报错 Could not start a new session. Possible causes are invalid address of the remote server相关的知识,希望对你有一定的参考价值。

关于 Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

代码中少了 webdriver.chrome.driver", "C:/selemiumlib/chromedriver.exe

应该为这样

        System.setProperty("webdriver.chrome.driver", "C:/selemiumlib/chromedriver.exe");
    //System.setProperty("webdriver.chrome.bin","C:/Program Files (x86)/Google/Chrome/Application/chrome.exe");
        System.setProperty("webdriver.chrome.bin","C:/Users/Admin/AppData/Local/Google/Chrome/Application/chrome.exe");
    WebDriver driver = new ChromeDriver();
    driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
    driver.get("http://www.baidu.com");
    driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
    driver.close();

 

 System.setProperty("webdriver.chrome.driver", "C:/selemiumlib/chromedriver.exe");

不添加这一行其实也可以,但要注意系统中chrome应该只有一个,否则报错

技术分享

 

正在研究一个系统里有不同版本的chrome的调用方法

 

 

以上是关于解决selemium报错 Could not start a new session. Possible causes are invalid address of the remote server的主要内容,如果未能解决你的问题,请参考以下文章

解决报错:IncompleteElementException: Could not find result map...

解决Postman报错:Could not send request

解决Postman报错:Could not send request

转 : Apache启动报错:could not bind to address [::]:443 解决办法

解决Mybatis报错Could not find resource mybatis-config.xml

Android studio报错Could not find method dependencyResolutionManagement() for arguments的解决方法