首页 > 其他 > 详细

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

时间:2016-02-24 12:36:50      阅读:4607      评论:0      收藏:0      [点我收藏+]

关于 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 or browser start-up failure

原文:http://www.cnblogs.com/xlmig/p/5212376.html

(2)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!