如何让Firefox在Mac OSX上使用Selenium WebDriver [英] How to get Firefox working with Selenium WebDriver on Mac OSX

查看:197
本文介绍了如何让Firefox在Mac OSX上使用Selenium WebDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图为 WebDriver 配置代理设置,所以我使用了下面的代码....

  FirefoxProfile profile = new FirefoxProfile(); 
profile.setPreference(network.proxy.type,1);
profile.setPreference(network.proxy.http,207.229.122.162);
profile.setPreference(network.proxy.http_port,3128);
WebDriver driver = new FirefoxDriver(profile);
selenium = new WebDriverBackedSelenium(driver,http://www.example.com/);

在执行文件后,我收到了异常...


org.openqa.selenium.WebDriverException:在PATH中找不到firefox二进制文件。

确保安装了firefox。操作系统似乎是:MAC



系统信息:os.name:'Mac OS X',os.arch:'x86_64',os.version:'10 .6.8 ',



java.version:'1.6.0_29'


$ b 驱动程序信息:driver.version:FirefoxDriver


任何人都可以帮我解释如何以及在哪里给路径 firefoxprofile()

解决方案

我相信你有几个选择:

您的PATH系统变量中的文件夹(您的Firefox二进制文件所在) - 这里是< a>。

或者调用

  WebDriver driver = new FirefoxDriver新的FirefoxBinary(新的文件(路径/你的/ firefox.exe)),配置文件); 


I am trying to config proxy settings for the WebDriver so I have used the following code ....

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 1);
profile.setPreference("network.proxy.http","207.229.122.162");
profile.setPreference("network.proxy.http_port", 3128); 
WebDriver driver = new FirefoxDriver(profile);
selenium = new WebDriverBackedSelenium(driver, "http://www.example.com/");

and after performing run on the file I am getting exception like ...

org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH.

Make sure firefox is installed. OS appears to be: MAC

System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.6.8',

java.version: '1.6.0_29'

Driver info: driver.version: FirefoxDriver

Can anyone help me out regarding how and where to give path to firefoxprofile()

I believe you have several options:

Either specify the folder (in which your Firefox binary is) in your PATH system variable - here's how.

Or call

WebDriver driver = new FirefoxDriver(new FirefoxBinary(new File("path/to/your/firefox.exe")), profile);

这篇关于如何让Firefox在Mac OSX上使用Selenium WebDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆