我正在使用Firefox 47.0.1
Marionette
驱动程序geckodriver-v0.8.0-win32
。但是我的浏览器异常无法访问,firefox
无法打开。
我的代码段如下所示:
System.setProperty("webdriver.gecko.driver", "C:/Documents and Settings/Admin/Desktop/wires-0.6.2-win/wires.exe");
GeckoDriverService service = new GeckoDriverService(new File("C:/Documents and Settings/Admin/Desktop/wires-0.6.2-win/wires.exe"), PortProber.findFreePort(), null, null);
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
cap.setCapability("firefox_binary", "G:/Program Files/Mozilla Firefox/firefox.exe");
driver = new MarionetteDriver(service, cap,PortProber.findFreePort());
将exception
显示为: -
org.openqa.selenium.remote.UnreachableBrowserException:不能 开始一个新的会议。可能的原因是遥控器的无效地址 服务器或浏览器启动失败。 构建信息:版本:' 2.53.0',修订版:' 35ae25b',时间:' 2016-03-15 16:57:40' 系统信息:主机:' computer_1',ip:' 192.168.1.100',os.name:' Windows XP',os.arch:' x86',os.version:' 5.1',java.version: ' 1.7.0_79' 驱动程序信息:driver.version:MarionetteDriver
答案 0 :(得分:0)
无需将geckodriver.exe
重命名为wires.exe
。并且不需要使用GeckoDriverService。通过稳定版本,他们简化了编码。只需下载GeckoDriver
并像
System.setProperty("webdriver.gecko.driver", "path\\to\\geckodriver.exe");
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability(FirefoxDriver.BINARY, "G:\\Program Files\\Mozilla Firefox\\firefox.exe");
WebDriver driver = new MarionetteDriver(caps);
答案 1 :(得分:0)
我假设您正在使用selenium 3.0 beta2。这是解决方案:
System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe"); //change geckodriver path accordingly.
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
webDriver = new MarionetteDriver(capabilities);
请从https://github.com/mozilla/geckodriver/releases下载最新的geckodriver。