FirefoxDriver调用firefox浏览器的安装路径应为C盘的默认目次下,若firefox安装在其他目次下履行时会报错:Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: XP
Build info: version: ""2.25.0"", revision: ""17482"", time: ""2012-07-18 21:09:54""
System info: os.name: ""Windows XP"", os.arch: ""x86"", os.version: ""5.1"", java.version: ""1.6.0_10""这是因为找不到firefox的原因。解决办法:1.从头安装firefox在默认路径下;2.直接用System.setProperty办法设置webdriver.firefox.bin的值package selenium.test.googleSearch;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.*;
public class BaiduFirefoxDriver {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.firefox.bin", "D:\Program Files\Mozilla Firefox\firefox.exe");
WebDriver driver=new FirefoxDriver();
driver.get("http://www.baidu.com/");
}
}
3.哄骗setCapability进行设置package selenium.test.googleSearch;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.*;
import org.openqa.selenium.remote.DesiredCapabilities;
public class BaiduFirefoxDriver {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
DesiredCapabilities capability=DesiredCapabilities.firefox();
capability.setCapability("firefox_binary",
"D:\Program Files\Mozilla Firefox\firefox.exe");
WebDriver driver = new FirefoxDriver(capability);
driver.get("http://www.baidu.com/");
}
}
4.用FirefoxBinary类和public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile)这个机关办法package selenium.test.googleSearch;
import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.*;
public class BaiduFirefoxDriver {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
File pathToFirefoxBinary = new File("D:\Program Files\Mozilla Firefox\firefox.exe");
FirefoxBinary firefoxbin = new FirefoxBinary(pathToFirefoxBinary);
WebDriver driver = new FirefoxDriver(firefoxbin,null);
driver.get("http://www.baidu.com/");
}
}
分享到:
相关推荐
java 使用 seleniumhq selenium Screenshot 实现调用浏览器驱动 截取图片 截取全图 https://blog.csdn.net/weixin_42749765/article/details/107404488 所需 火狐驱动 64位 linux +windows
selenium-firefox-driver-2.47.1.jar
Python+Selenium+Firefoxdriver爬虫 用到的火狐浏览器安装包和对应版本的geckodriver驱动下载
最新版的火狐driver,这是最新的64位版本,能够支持最新版的firefox的浏览器
Firefox geckodriver
liunux版firefox让你在linux下你也可以畅游网络世界,
fireFOX 支持java功能版本,可替代IE浏览器,浏览JAVA网站。
WebDriver 模拟火狐浏览器登录包 selenium-java-2.45.0.jar selenium-java-2.45.0-srcs.jar
包内包含java和C#的3.14版本包,以及ChromeDriver 2.45 支持 Chrome v70-72。以及FireFoxDriver 0.23.0版本,如需其它版本可以私信联系,没有积分的可以私信,本人看到后会帮忙代发
Selenium-3.3.1版本配套的FrieFox V47和对应的geckodriver V0.15版本32位和64位驱动
docker-firefoxdriver
firefox4 专用ZendFirefoxToolbar 很多朋友都喜欢使用ZendFirefoxToolbar调试程序。 刚寻得firefox4版本的toolbar 共享一下
Firefox OS 系统的简介; Firefox OS调试工具用法介绍; Firefox OS 中简单app 写法及部分API 介绍
Zend Studio is the leading professional-grade PHP development environment, designed to maximize developer productivity by enabling you to develop and maintain code faster, solve application problems ...
Firefox OS的概览以及开发环境的介绍
内含windows mac linux 谷歌 chromedriver 64位驱动;火狐 geckodriver 32/64 位 驱动 最新版 ,谷歌驱动版本2.40 火狐版本 v0.21.0
Firefox,安装webSphere必须,Linux版本
WebDriver 模拟火狐浏览器登录包 selenium-java-2.45.0.jar selenium-java-2.45.0-srcs.jar 带源码包
firefox os 开发者文档对初学开发者是个不错的开发指导中文文档,对你学习firefox os 开发有一定的帮助!