使用firefoxprofile,selenium设置firefox,初始化firefox
1、什么是firefoxprofile
简单的来说就是个人定制,比如你设置自己访问主页,禁用加载图片这些个性化的设置,都可以保存到一个文件夹下,就是firefoxprofile,下次使用时候,加载该firefoxprofile,就可以让自己火狐浏览器设置跟之前配置一样
2、为什么selenium要用firefoxprofile
我们自动化测试的时候,有时不需要图片加载出来,提高浏览器加载速度,从而提高脚本的执行速度。另外在一些网络比较差的环境下,禁用css、图片等加载可以提高访问速度
方法:
1、创建自己的firefoxprofile
关闭所有Filefox浏览窗—》运行Firefox Manager,点击windows“开始”-->“运行”,然后在输入框输入firefox.exe -ProfileManager,点击“确定”按钮-》创建一个新的Profile,只需点击“创建配置文件”按钮,在接着出现的向导窗口里输入配置文件名
现在就创建了一个独立的Firefox Profile配置文件,启动Profile配置文件的Firefox
新建一个bat文件,输入命令行
set MOZ_NO_REMOTE=1
start "" "C:\Program Files\Mozilla Firefox Formal\firefox.exe" -P firefoxprofile文件名在新打开的浏览器中,你可以随意设置火狐,这些设置都保存在你的个性化firefoxprofile中
2、现在使用selenium调用firefoxprofile
firefox_profile = webdriver.FirefoxProfile("D:\Downloads") browser = webdriver.Firefox(firefox_profile=firefox_profile)D:\Downloads路径存放着我firefoxprofile
使用firefoxprofile,selenium设置firefox,初始化firefox的更多相关文章
- Selenium 设置浏览器下载 Firefox 和Chrome
当我们在使用Selenium运行自动化测试时,偶尔需要用到下载功能,但浏览器的下载可能会弹出下载窗口,或者下载路径不是我们想要保存的位置,所以在通过Selenium启动浏览器时需要做相关的设置,将使这 ...
- selenium设置proxy、headers(phantomjs、Chrome、Firefox)
phantomjs 设置ip 方法1: service_args = [ '--proxy=%s' % ip_html, # 代理 IP:prot (eg:192.168.0.28:808) '--p ...
- Python+Selenium 环境配置之Firefox,IE,Chrome几种浏览器运行
Selenium(Webdriver)支持Firefox,IE,Chrome等多个浏览器.很多人可能装环境时遇到很多问题,下面简单聊聊如何配置测试这几个浏览器以及相关通过简单的实例来测试. 1.Fir ...
- 【总结】selenium webdriver 远程连接firefox和IE 环境搭建
参考链接:http://code.google.com/p/selenium/wiki/Grid2 本地环境为:win7,eclipse,jdk 1.7,本机ip为192.168.0.30 1.下载所 ...
- Selenium+python+shell+crontab+firefox
最近在尝试一个自动打卡的脚本,发现了几个问题,特此记录一下. 环境: Ubuntu 12.04.4 LTS selenium 2.43.0 firefox 32.0.3 1 本来机器上selenium ...
- selenium 3+python3.6+firefox的windows详细环境搭建以及小demo
最近也是学习了下selenium和python,就记录了下在自己工作机上环境的搭建过程以及小demo 1,安装python3.6.1 我是去官网直接下载当前最新版的python3.6.1 官网网址为h ...
- selenium设置代理,基于chrome浏览器
工作中遇到需要对项目中使用的selenium设置代理,跟大家分享一下. 1.下载chromeDriver:http://chromedriver.storage.googleapis.com/inde ...
- libevent (一) socket属性设置与初始化操作
socket属性设置与初始化操作 libevent是一个事件触发的网络库,适用于windows.linux.bsd等多种平台,内部使用select.epoll.kqueue等系统调用管理事件机制.著名 ...
- selenium设置chrome和phantomjs的请求头信息
selenium设置chrome和phantomjs的请求头信息 出于反爬虫也好-跳转到手机端页面也好都需要设置请求头,那么如何进行呢? 目录 一:selenium设置phantomjs请求头: ...
随机推荐
- Response 关于浏览器header的方法
Response.AddHeader Response.AddHeader使用实例 1.文件下载,指定默认名 Response.AddHeader("content-type" ...
- The number of divisors(约数) about Humble Numbers
The number of divisors(约数) about Humble Numbers Time Limit: 2000/1000 MS (Java/Others) Memory Lim ...
- VS2012 的MVC4实例
原文链接:http://wenku.baidu.com/link?url=nkq-UZd-Ui83Nuoh66n4KqdwK4V_zzKqakmmG6VBgq2BfWlMiPhz1JXN9R3CWxN ...
- Java--static interface
http://stackoverflow.com/questions/8374646/what-is-a-static-interface-in-java http://stackoverflow.c ...
- WIN7_64位系统安装oracle以及PLSQL方法(不用装32位oracle客户端)
一.oracle10g安装,比较简单 1.去Oracle网站下载Vista版的Oracle:Oracle Database 10g Release 2 (10.2.0.4) for Microsoft ...
- cf479D Long Jumps
D. Long Jumps time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- LeeCode-Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once. For examp ...
- linux查看CPU高速缓存(cache)信息
一.Linux下查看CPU Cache级数,每级大小 dmesg | grep cache 实例结果如下: 二.查看Cache的关联方式 在 /sys/devices/system/cpu/中查看相应 ...
- tangible T4 Editor 2.2.3 plus modeling tools for VS 2012 扩展名
tangible T4 Editor 2.2.3 plus modeling tools for VS 2012 扩展名 tangible T4 Editor 2.2.3 plus modeling ...
- array_multisort 关联(string)键名保持不变,但数字键名会被重新索引。
$array = [ '2' => [ 'title' => 'Flower', 'order' => 3 ], '3' => [ 'title' => 'Rock', ...