python splinter
from splinter.browser import Browser
with Browser() as b:
for url,name in web:
b.visit(url)
b.fill('Password','password')
button=b.find_by_id('loginBtn')
button.click()
t=b.find_by_id('FreeSpaceId')
print name,t.text
tab=b.find_by_id('login-table')
ti=tab.first.find_by_xpath('tbody/tr/td/input')
ti[0].fill('username')
ti[1].fill('password')
button=b.find_by_text('Login')
button.click()
firefox代理
driver:https://github.com/mozilla/geckodriver/releases
proxy_settings={'network.proxy.type': 1,
'network.proxy.no_proxies_on':'172.0.0.0/8,10.0.0.0/8,localhost,127.0.0.0/8,::1',
'network.proxy.http':'172.1.1.1','network.proxy.http_port':8080,
'network.proxy.ssl':'172.1.1.1','network.proxy.ssl_port':8080}
b=Browser('firefox',profile_preferences=proxy_settings)
chrome代理
driver:http://chromedriver.storage.googleapis.com/index.html
https://sites.google.com/a/chromium.org/chromedriver/-
from splinter.driver.webdriver.chrome import Options, Chrome
chrome_options = Options()
chrome_options.add_argument('--proxy-server=http://%s' % PROXY)
b=Browser('chrome');b.driver=Chrome(chrome_options=chrome_options)
#--no-proxy-server
#--proxy-auto-detect
#--proxy-server=<scheme>=<uri>[:<port>][;...] | <uri>[:<port>] | "direct://"
##--proxy-server="http=foopy:80;ftp=foopy2"
##--proxy-server="foopy:8080"
## --proxy-server="direct://" will cause all connections to not use a proxy.
#--proxy-bypass-list=(<trailing_domain>|<ip-address>)[:<port>][;...]
##--proxy-server="foopy:8080" --proxy-bypass-list="*.google.com;*foo.com;127.0.0.1:8080"
#--proxy-pac-url=<pac-file-url> #selenium
from selenium import webdriver PROXY = "23.23.23.23:3128" # IP:PORT or HOST:PORT chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=http://%s' % PROXY) chrome = webdriver.Chrome(chrome_options=chrome_options)
chrome.get("http://whatismyipaddress.com")
如使用
b=Browser('chrome',chrome_options=chrome_options)
需要修改库中的chrome.py
if 'chrome_options' in kwargs:
options = kwargs.get('chrome_options', Options())
del kwargs['chrome_options']
else:
options = Options()
python splinter的更多相关文章
- python+splinter实现12306网站刷票并自动购票流程
python+splinter实现12306网站刷票并自动购票流程 通过python+splinter,实现在12306网站刷票并自动购票流程(无法自动识别验证码). 此类程序只是提高了12306网站 ...
- Python splinter 环境搭建
今天无意间看到了splinter. Splinter是一个使用Python开发的开源Web应用测试工具.它可以帮你实现自动浏览站点和与其进行交互. Splinter对已有的自动化工具(如:Seleni ...
- python splinter chromedriver下载地址(国内可用)
http://chromedriver.storage.googleapis.com/index.html
- 简单的Python 火车抢票程序
当你想查询一下火车票信息的时候,你还在上12306官网吗?或是打开你手机里的APP?下面让我们来用Python写一个命令行版的火车票查看器, 只要在命令行敲一行命令就能获得你想要的火车票信息!如果你刚 ...
- python代码实现抢票助手
一. 代码使用Python+Splinter开发,Splinter是一个使用Python开发的开源Web应用测试工具,它可以帮你实现自动浏览站点和与其进行交互. 二. 安装好Python 3或2都可以 ...
- splinter(python操作浏览器魔魁啊)
from splinter import Browser def main(): browser = Browser() browser.visit('http://google.com') brow ...
- python学习之——splinter使用
开始学习使用splinter工具了,目前是摸索中,先熟悉splinter工具的使用方法~~ 实现功能: 打开firefox浏览器->www.baidu.com->输入关键词 python, ...
- python学习之——splinter介绍
Splinter是什么: 是一个用 Python 编写的 Web 应用程序进行验收测试的工具. Splinter执行的时候会自动打开你指定的浏览器,访问指定的URL,然后你所开发的模拟的任何行为,都会 ...
- Python自动化测试工具Splinter简介和使用实例
Splinter 快速介绍 官方网站:http://splinter.cobrateam.info/ 官方介绍: Splinter is an open source tool for testing ...
随机推荐
- Orcle基本语句(四)
--显示员工的编号,姓名,工资,工资级别,所在部门的名称;(使用emp表) SELECT * FROM emp; SELECT * FROM salgrade; SELECT * FROM dept; ...
- 29. Xshell连接Linux下Oracle无法回退的解决办法
使用Xshell 连接远程Linux 数据库服务器,当切换到sqlplus 控制台时,输入错误字符的时候,使用回退键修改时,显示^H. 解决方法:切换至root用户,直接输入stty erase ^H ...
- MAXIMO-数据库配置属性数据类型解释
ALN: 字母数字字符,混合大小写,最大长度取决于数据库 Oracle = 4000 个字符 Sql Server = 8000 个字符 DB2 = 32672 个 ...
- js 中数字问题
在js中请注意数字是没有长度的, 不能使用for循环遍历数字的长度 操作时通过.toString()把数字转换成字符串后通过字符串的.length 属性得到长度
- JAVA-系统-【2】-创建自增长的用户表
[2]创建数据库表 用户表 自增 1.用户表结构 数据excel 表1 2.创建表 Create table A_USER( id number primary key, username ) n ...
- html focus事件小学问
focus事件千万不要有alert方法,不然在有些浏览器会进入死循环的.例如:$('#test').focus(function(){ alert('dead loop'); }); 在chrome下 ...
- 读《JavaScript DOM编程艺术》
国庆假期花了三四天看了这本书,书很薄,因为是入门书,干货也不是很多. 4. childNodes nodeType nodeValue firstChild lastChild childNodes返 ...
- shell脚本的执行方式
编写好的shell脚本(如:test),可以采取两种方式进行运行: 一. $ sh test 一般不采用这种调用方式,尤其不采用"sh<test"的调用方式,因为这种方式将禁 ...
- 第一部分:C9高校、985和211、双一流
第一部分:C9高校.985和211.双一流 C9高校,包括:清北.复交.浙南.中科大西交大和哈工大.1998年5月4日,时任国家主席江.泽.民在庆祝北京大学建校100周年大会上代表中国共.产.党和中华 ...
- Easyui表单之下拉列表的三级联动
一.实现三级联动需要连接数据库 二.需要JSON数据的解析 三.需要Servlet类与界面相对应值的传递 1. 界面层需要的代码如下: <!DOCTYPE html> <html&g ...