Selenium 设定firefox的启动路径
来源:互联网 发布:js本页面重载 编辑:程序博客网 时间:2024/05/15 04:29
http://nickelen.iteye.com/blog/1397449
# 火狐启动路径
如果安装了多个Firefox版本,若在创建FirefoxDriver时不指定路径,则启动安装在默认路径下的Firefox浏览器,C:\Program Files\Mozilla Firefox\firefox.exe
- WebDriver webDriver = new FirefoxDriver();
WebDriver webDriver = new FirefoxDriver();
指定路径通过设定系统属性来实现:
- System.setProperty("webdriver.firefox.bin", "C:\\Program Files\\Mozilla Firefox\\firefox.exe");
- WebDriver webDriver = new FirefoxDriver();
System.setProperty("webdriver.firefox.bin", "C:\\Program Files\\Mozilla Firefox\\firefox.exe");WebDriver webDriver = new FirefoxDriver();
此时启动为该特定路径下的火狐浏览器实例。
# FirefoxProfile的设定
若使用不带参数的构造方法:new FirefoxDriver(),则会在该路径下生成类似的匿名Profile(Win7):
C:\Users\XXXX\AppData\Local\Temp\anonymous5266162376255423678webdriver-profile
该Profile是从火狐浏览器的默认Profile拷贝而来,火狐浏览器的默认Profile存放在:
C:\Users\daniel.chen\AppData\Roaming\Mozilla\Firefox\Profiles\XXXX.default
若需要使用特定Profile启动,应该使用FirefoxDriver(FirefoxProfile profile)的构造方法,例如:
- FirefoxProfile profile = new FirefoxProfile(new File("D:\\daniel\\FirefoxProfile\\"));
- WebDriver webDriver = new FirefoxDriver(profile);
FirefoxProfile profile = new FirefoxProfile(new File("D:\\daniel\\FirefoxProfile\\"));WebDriver webDriver = new FirefoxDriver(profile);
另,创建新的Profile可以在Run中输入 firefox.exe -p 在打开的Profile Manager中管理profile,详情可参考:http://support.mozilla.org/zh-CN/kb/%E7%AE%A1%E7%90%86%E7%94%A8%E6%88%B7%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6
- Selenium 设定firefox的启动路径
- selenium启动本机的firefox
- selenium启动Firefox示例
- Selenium启动无法启动firefox,遇到的错误
- selenium(webdriver)学习笔记2--打开指定路径的firefox
- selenium java 设置firefox的默认下载文件路径
- selenium启动的firefox开启新的匿名的profiles
- selenium 启动firefox浏览器问题
- Selenium启动加载用户配置的浏览器(Chrome/Firefox)
- python selenium启动不了火狐浏览器(firefox)的解决办法
- selenium支持的Firefox
- Selenium python 启动firefox浏览器的异常selenium.common.exceptions.WebDriverException: Message: 'geckodriver'
- selenium中各种场景下启动Firefox
- selenium启动firefox时加载配置
- selenium启动firefox时加载扩展
- Selenium的路径表达式
- Selenium WebDriver启动FireFox浏览器报错org/w3c/dom/ElementTraversal的解决方案
- 去掉selenium启动firefox每次都会弹出导入系统收藏夹提示框的方法
- 成也定位 败亦定位——闲聊知名互联网企业的定位失误
- 2012数学建模第一轮模拟总结
- jquery iframe操作
- select, poll和epoll的区别(转)
- VPN需要真正地走向大众
- Selenium 设定firefox的启动路径
- Assembly
- QQ网页快速入口
- 何为产品经理?
- 位图显示
- error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CchatDlg::* )(CPoint)' to 'UI
- c# 调用c++dll挂钩其他程序线程或者进程
- iPad UIDeviceHardware hw.machine codename
- error C4430: missing type specifier - int assumed. Note: C++ does not support default-int