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 ...
随机推荐
- 你还记得windows workflow foundation吗
很多年前,windows workflow foundation还叫WWF,而直译过来的名称让很多人以为它就是用来开发工作流或者干脆就是审批流的. 博主当年还是个懵懂的少年,却也知道微软不会大力推一个 ...
- ASP.NET MVC 中将FormCollection与实体间转换方法
将Action动作中传递的FormCollection转变成对应的实体,可以使用Controller的TryUpdateModel()方法. public ActionResult Create(Fo ...
- python的optparse模块使用
name or flags:就是参数的名称或标志 -f --file,-q --quit 等,其中-f表示option的缩写,--file表示option的全称 nargs:命令行参数的个数,一般使用 ...
- C--关键字static
static在C中主要有两个作用: 1.修饰变量 (局部变量.全局变量 都存在内存的静态区) 静态全局变量: 作用域仅限于变量被定义的文件中,其中文件即使用extern声明也无法使用它. 静态局部变 ...
- js面向对象之创建对象
工厂模式 function createPerson(name,age,job){ var o = new Object(); o.name = name; o.age = age; o.job = ...
- 照片元数据信息以及在照片中写入gps信息
/// 照片元数据编码 在下面的文章里,可以看到图片所有的元数据定义信息 https://msdn.microsoft.com/zh-cn/library/system.drawing.imaging ...
- android subclipse subversive
subclipse - http://subclipse.tigris.org/update_1.10.x android 开源框架 直接拿来用!最火的Android开源项目整理 http://blo ...
- Android Studio tips1
Android Studio 真机测试出现 device can not found 1.安装与手机版本一样的sdk 2.(重要!!)手机的驱动在电脑上没有正确的安装,安装豌豆荚可以解决!
- 第十五课:奇葩的元素节点iframe
iframe一般用来加载一个页面,然后嵌入到主页面中.创建起来消耗资源,而且消耗连接数.但是它是一个物超所值的东西,可以实现无缝刷新,模拟onhashchange跨域,安全的加载第三方资源与广告,实现 ...
- libsvm 训练后的模型参数讲解(转)
主要就是讲解利用libsvm-mat工具箱建立分类(回归模型)后,得到的模型model里面参数的意义都是神马?以及如果通过model得到相应模型的表达式,这里主要以分类问题为例子.测试数据使用的是li ...