selenium学习中遇到的问题

xiaoxiao2021-02-28  86

一:Exception in thread “main” org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: VISTA Build info: version: ‘2.47.1’, revision: ‘411b314’, time: ‘2015-07-30 02:56:46’

错误如下图所示:

出现这个错误的主要原因是:Firefox未安装在默认位置,使用System.setProperty设置Firefox安装路径即可

System.setProperty("webdriver.firefox.bin", "D:/Program Files (x86)/Mozilla Firefox/firefox.exe");

二、Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

原因一:安装相应浏览器的driver,如Chrome浏览器就是chromedriver,下载下来之后,是一个.exe文件,将放在在chrome的安装目录下(C:\Program Files (x86)\Google\Chrome\Application),然后再配置环境变量,在path最后添加;C:\Program Files (x86)\Google\Chrome\Application 注意:Chromedriver与Chrome版本号要相对应

chromedriver版本支持的Chrome版本v2.33v60-62v2.32v59-61v2.31v58-60v2.30v58-60v2.29v56-58v2.28v55-57v2.27v54-56v2.26v53-55v2.25v53-55v2.24v52-54v2.23v51-53v2.22v49-52v2.21v46-50v2.20v43-48v2.19v43-47v2.18v43-46v2.17v42-43v2.13v42-45v2.15v40-43v2.14v39-42v2.13v38-41v2.12v36-40v2.11v36-40v2.10v33-36v2.9v31-34v2.8v30-33v2.7v30-33v2.6v29-32v2.5v29-32v2.4v29-32

原因二:浏览器与selenium版本不对应,例如Firefox与selenium对应版本

SeleniumFireFox2.25.0182.30.0192.31.0202.42.2292.44.033 (不支持31,2014/12/1)


转载请注明原文地址: https://www.6miu.com/read-1000033.html

最新回复(0)