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的更多相关文章

  1. python+splinter实现12306网站刷票并自动购票流程

    python+splinter实现12306网站刷票并自动购票流程 通过python+splinter,实现在12306网站刷票并自动购票流程(无法自动识别验证码). 此类程序只是提高了12306网站 ...

  2. Python splinter 环境搭建

    今天无意间看到了splinter. Splinter是一个使用Python开发的开源Web应用测试工具.它可以帮你实现自动浏览站点和与其进行交互. Splinter对已有的自动化工具(如:Seleni ...

  3. python splinter chromedriver下载地址(国内可用)

    http://chromedriver.storage.googleapis.com/index.html

  4. 简单的Python 火车抢票程序

    当你想查询一下火车票信息的时候,你还在上12306官网吗?或是打开你手机里的APP?下面让我们来用Python写一个命令行版的火车票查看器, 只要在命令行敲一行命令就能获得你想要的火车票信息!如果你刚 ...

  5. python代码实现抢票助手

    一. 代码使用Python+Splinter开发,Splinter是一个使用Python开发的开源Web应用测试工具,它可以帮你实现自动浏览站点和与其进行交互. 二. 安装好Python 3或2都可以 ...

  6. splinter(python操作浏览器魔魁啊)

    from splinter import Browser def main(): browser = Browser() browser.visit('http://google.com') brow ...

  7. python学习之——splinter使用

    开始学习使用splinter工具了,目前是摸索中,先熟悉splinter工具的使用方法~~ 实现功能: 打开firefox浏览器->www.baidu.com->输入关键词 python, ...

  8. python学习之——splinter介绍

    Splinter是什么: 是一个用 Python 编写的 Web 应用程序进行验收测试的工具. Splinter执行的时候会自动打开你指定的浏览器,访问指定的URL,然后你所开发的模拟的任何行为,都会 ...

  9. Python自动化测试工具Splinter简介和使用实例

    Splinter 快速介绍 官方网站:http://splinter.cobrateam.info/ 官方介绍: Splinter is an open source tool for testing ...

随机推荐

  1. 解决MD5问题

    使用VS时报错此实现不是 Windows 平台 FIPS 验证的加密算法的一部分. 解决方案如下:在window中打开功能里输入regedit,回车打开注册器.然后进入如下路径中 HKEY_LOCAL ...

  2. webApi上传下载文件

    上传文件通过webApi html端调用时包含(form提交包含 enctype="multipart/form-data",才可以启作用获取到文件) public class U ...

  3. NK3C程序资源占用分析

    1.程序放在一个Tomcat下最低配置推荐:最大堆:768M,最大PermGen:160M(-Xmx768m -XX:MaxPermSize=160m) 2.机器最低配置推荐:最小内存2G 3.正式运 ...

  4. Sql Server 按行处理表数据思路

    SqlServer的游标当超过1000行左右的时候效率极其低下. DECLARE @Company VARCHAR(12)='' SELECT TOP 1 @Company=CompanyID FRO ...

  5. ue4标签测试与总结(UPROPERTY)

    学习UE4框架中的标签,本篇是总结成员变量标签UPROPERTY. 引擎版本:4.12.5 前期准备: 1.新建项目,C++空模板,新建C++类,继承AActor,名称MyActor. 使用TestA ...

  6. MySQL 第十天(视图、存储过程、函数、触发器)

    MySql高级-视图.函数.存储过程.触发器 目录 一.视图    1 1.视图的定义    1 2.视图的作用    1 (1)可以简化查询.    1 (2)可以进行权限控制,    3 3.查询 ...

  7. jsvascript—谜之this?

    原文:Gentle explanation of ‘this’ keyword in JavaScript 1. 迷之 this 对于刚开始进行 JavaScript 编程的开发者来说,this 具有 ...

  8. ubuntu下 too many file open 异常

    后台高并发或者多线程的情况下,无论是操作数据库还是操作文件,应用报出 too many file open 异常,其原因是受宿主系统文件数的限制.问题解决方式如下: 第一步:检查所在系统的文件数限制 ...

  9. delphi数据类型及占用的字节数 C++ 对应数据类型

    delphi byte:1个字节. int/Integer: long: long long:8字节,64位 shortInt:2字节,16位 LongInt:4字节,32位 Int64:8字节,64 ...

  10. 深入理解jQuery中的Deferred

    引入 1  在开发的过程中,我们经常遇到某些耗时很长的javascript操作,并且伴随着大量的异步. 2  比如我们有一个ajax的操作,这个ajax从发出请求到接收响应需要5秒,在这5秒内我们可以 ...