[英]Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: Failed to start browser
I use the same code and also version on 2 computers, but another cannot start Firefox. 我在2台计算机上使用相同的代码和版本,但是另一个无法启动Firefox。 Please help me
请帮我
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Failed to start browser C:\\Program Files\\Mozilla Firefox\\firefox.exe: permission denied (WARNING: The server did not provide any stacktrace information)
线程“主要” org.openqa.selenium.SessionNotCreatedException中的异常:无法启动浏览器C:\\ Program Files \\ Mozilla Firefox \\ firefox.exe:权限被拒绝(警告:服务器未提供任何堆栈跟踪信息)
Command duration or timeout: 0 milliseconds
命令持续时间或超时:0毫秒
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
构建信息:版本:'3.3.1',修订版:'5234b32',时间:'2017-03-10 09:04:52 -0800'
System info: host: 'XUANTRUONG-PC', ip: '192.168.1.95', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'系统信息:主机:'XUANTRUONG-PC',ip:'192.168.1.95',操作系统名称:'Windows 10',os.arch:'amd64',os.version:'10 .0',java.version:'1.8 .0_121'
Driver info: driver.version: FirefoxDriver驱动程序信息:driver.version:FirefoxDriver
To work with Selenium 3.4.0 you need to mandatory download gecko driver v0.16.0 (or above) from here and save it in your machine. 要使用Selenium 3.4.0,您需要从此处强制下载gecko驱动程序v0.16.0(或更高版本)并将其保存在您的计算机中。 Upgrade your Mozila Firefox to the latest stable version (v 53.x).
将Mozila Firefox升级到最新的稳定版本(v 53.x)。 Use the absolute path of the geckodriver in your code while
System.setProperty
在
System.setProperty
,在代码中使用geckodriver的绝对路径
In your code: 在您的代码中:
Replace System.setProperty("webdriver.firefox.marionette","C:\\\\geckodriver.exe");
替换
System.setProperty("webdriver.firefox.marionette","C:\\\\geckodriver.exe");
with System.setProperty("webdriver.gecko.driver","C:\\\\your_directory\\\\geckodriver.exe");
使用
System.setProperty("webdriver.gecko.driver","C:\\\\your_directory\\\\geckodriver.exe");
Let me know if this helps you. 让我知道这是否对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.