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 ...
随机推荐
- 【MySQL】编译安装
安装所需环境: yum install cmake make glibc gcc gcc-c++ libstdc++* sysstat lrzsz libtool libxml* libtool-lt ...
- MacBook Pro/Air 下使用 linux ubuntu 系统 波浪号“~”变成其他 符号 的完美解决办法
打开终端,输入: sudo su - > /sys/module/hid_apple/parameters/iso_layout sudo su -需要root权限,所以使用前请注意已下载roo ...
- TortoiseGit 图标不显示
1. 确认注册表:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdent ...
- 使用ssh连接远程主机
在linux系统中,ssh是远程登录的默认工具,因为该工具的协议使用了RSA/DSA的加密算法.该工具做linux系统的远程管理是非常安全的. ssh登录远程主机(服务器)一般有两种方式:无密钥方式 ...
- JSON与XML优缺点对比分析
本文从各个方面向大家对比展示了json和xml的优缺点,十分的全面细致,有需要的小伙伴可以参考下. 1. 定义介绍 1.1 XML定义 扩展标记语言 (Extensible Markup Langua ...
- Hcm data loader for cancel work relationship
好好总结一下这个task.没有做好的东西:1.现有的资料和各种各样的工具没有很好的利用起来,造成了用了很多的时间去了解和自己学习.非常的不舒服的.下次要避免这样的浪费时间,学会在工作中学习.现在以及以 ...
- php电话号码正则表达式常用例子
电话号码正则表达式(支持手机号码,3-4位区号,7-8位直播号码,1-4位分机号) 02 03 ((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{ ...
- bootstrap--小李子demo
最近忙啊...看到各位冬鞋都在认真写博客,认真敲代码,认真工作,总觉得自己时间太少,总觉得时间不够,老了...... 进正题: 上次不知从哪里(忘了)下载了bootstrap的一些使用小demo,以后 ...
- Canvas画图在360浏览器中跑偏的问题
问题描述,canvas画图的js代码中编写的是画正方形的代码,结果在360浏览器上变成了长方形,不知道怎么回事,请问各位大神是否遇到过此类问题? <!DOCTYPE html> <h ...
- getGLES1ExtensionString: Could not find GLES 1.x config!
编辑模拟器中 Emulated performance 中不选 auto 和 Hardware - GLES 2.0,选择Software-GLES2.0.解决问题