文档章节

Windows中Splinter的安装和使用

莉莉不是小狐狸啊
 莉莉不是小狐狸啊
发布于 2018/11/02 17:13
字数 1627
阅读 35
收藏 0

核心内容: 
1、Splinter的简介 
2、Splinter的安装 
3、检验Splinter是否安装成功 
4、Geckodriver驱动的安装 
5、Splinter的操作示例

(一)Splinter的简介
Splinter是一个使用Python开发的开源Web应用测试工具,它可以帮你实现自动浏览站点和与其进行交互。我也是因为工作需求的原因才找到这个软件的。

(二)Splinter的安装
注意:前提必须要安装好python,不然是不对的。 
1、下载的网址:https://pypi.python.org/pypi/splinter/,目前最新版本是0.7.5,测试平台是window7 64位(这个不太确定),Windows用的也是tar.gz。 

 
2、先将下载好的Splinter解压缩到指定的文件夹当中,在这里为D:\Splinter。 

3、打开cmd黑窗口,并通过相应命令进入到Splinter解压缩之后所在的目录,在这里即为:D:\Splinter\splinter-0.7.5。 

4、随后输入命令python setup.py build,如下所示:

D:\Splinter\splinter-0.7.5>python setup.py build
running build
running build_py
creating build
creating build\lib
creating build\lib\splinter
copying splinter\browser.py -> build\lib\splinter
copying splinter\cookie_manager.py -> build\lib\splinter
copying splinter\element_list.py -> build\lib\splinter
copying splinter\exceptions.py -> build\lib\splinter
copying splinter\meta.py -> build\lib\splinter
copying splinter\utils.py -> build\lib\splinter
copying splinter\__init__.py -> build\lib\splinter
creating build\lib\splinter\driver
copying splinter\driver\djangoclient.py -> build\lib\splinter\driver
copying splinter\driver\element_present.py -> build\lib\splinter\driver
copying splinter\driver\flaskclient.py -> build\lib\splinter\driver
copying splinter\driver\lxmldriver.py -> build\lib\splinter\driver
copying splinter\driver\zopetestbrowser.py -> build\lib\splinter\driver
copying splinter\driver\__init__.py -> build\lib\splinter\driver
creating build\lib\splinter\request_handler
copying splinter\request_handler\status_code.py -> build\lib\splinter\request_handler
copying splinter\request_handler\__init__.py -> build\lib\splinter\request_handler
creating build\lib\splinter\driver\webdriver
copying splinter\driver\webdriver\chrome.py -> build\lib\splinter\driver\webdriver
copying splinter\driver\webdriver\cookie_manager.py -> build\lib\splinter\driver\webdriver
copying splinter\driver\webdriver\firefox.py -> build\lib\splinter\driver\webdriver
copying splinter\driver\webdriver\phantomjs.py -> build\lib\splinter\driver\webdriver
copying splinter\driver\webdriver\remote.py -> build\lib\splinter\driver\webdriver
copying splinter\driver\webdriver\__init__.py -> build\lib\splinter\driver\webdriver
running egg_info
writing requirements to splinter.egg-info\requires.txt
writing splinter.egg-info\PKG-INFO
writing top-level names to splinter.egg-info\top_level.txt
writing dependency_links to splinter.egg-info\dependency_links.txt
reading manifest file 'splinter.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'tests'
writing manifest file 'splinter.egg-info\SOURCES.txt'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
5、上一步命令执行成功后,接着执行命令python setup.py install,如下所示:

D:\Splinter\splinter-0.7.5>python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to splinter.egg-info\requires.txt
writing splinter.egg-info\PKG-INFO
writing top-level names to splinter.egg-info\top_level.txt
writing dependency_links to splinter.egg-info\dependency_links.txt
reading manifest file 'splinter.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'tests'
writing manifest file 'splinter.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\bdist.win32
creating build\bdist.win32\egg
creating build\bdist.win32\egg\splinter
copying build\lib\splinter\browser.py -> build\bdist.win32\egg\splinter
copying build\lib\splinter\cookie_manager.py -> build\bdist.win32\egg\splinter
creating build\bdist.win32\egg\splinter\driver
copying build\lib\splinter\driver\djangoclient.py -> build\bdist.win32\egg\splinter\driver
copying build\lib\splinter\driver\element_present.py -> build\bdist.win32\egg\splinter\driver
copying build\lib\splinter\driver\flaskclient.py -> build\bdist.win32\egg\splinter\driver
copying build\lib\splinter\driver\lxmldriver.py -> build\bdist.win32\egg\splinter\driver
creating build\bdist.win32\egg\splinter\driver\webdriver
copying build\lib\splinter\driver\webdriver\chrome.py -> build\bdist.win32\egg\splinter\driver\webdriver
copying build\lib\splinter\driver\webdriver\cookie_manager.py -> build\bdist.win32\egg\splinter\driver\webdriver
copying build\lib\splinter\driver\webdriver\firefox.py -> build\bdist.win32\egg\splinter\driver\webdriver
copying build\lib\splinter\driver\webdriver\phantomjs.py -> build\bdist.win32\egg\splinter\driver\webdriver
copying build\lib\splinter\driver\webdriver\remote.py -> build\bdist.win32\egg\splinter\driver\webdriver
copying build\lib\splinter\driver\webdriver\__init__.py -> build\bdist.win32\egg\splinter\driver\webdriver
copying build\lib\splinter\driver\zopetestbrowser.py -> build\bdist.win32\egg\splinter\driver
copying build\lib\splinter\driver\__init__.py -> build\bdist.win32\egg\splinter\driver
copying build\lib\splinter\element_list.py -> build\bdist.win32\egg\splinter
copying build\lib\splinter\exceptions.py -> build\bdist.win32\egg\splinter
copying build\lib\splinter\meta.py -> build\bdist.win32\egg\splinter
creating build\bdist.win32\egg\splinter\request_handler
copying build\lib\splinter\request_handler\status_code.py -> build\bdist.win32\egg\splinter\request_handler
copying build\lib\splinter\request_handler\__init__.py -> build\bdist.win32\egg\splinter\request_handler
copying build\lib\splinter\utils.py -> build\bdist.win32\egg\splinter
copying build\lib\splinter\__init__.py -> build\bdist.win32\egg\splinter
byte-compiling build\bdist.win32\egg\splinter\browser.py to browser.pyc
byte-compiling build\bdist.win32\egg\splinter\cookie_manager.py to cookie_manager.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\djangoclient.py to djangoclient.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\element_present.py to element_present.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\flaskclient.py to flaskclient.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\lxmldriver.py to lxmldriver.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\webdriver\chrome.py to chrome.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\webdriver\cookie_manager.py to cookie_manager.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\webdriver\firefox.py to firefox.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\webdriver\phantomjs.py to phantomjs.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\webdriver\remote.py to remote.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\webdriver\__init__.py to __init__.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\zopetestbrowser.py to zopetestbrowser.pyc
byte-compiling build\bdist.win32\egg\splinter\driver\__init__.py to __init__.pyc
byte-compiling build\bdist.win32\egg\splinter\element_list.py to element_list.pyc
byte-compiling build\bdist.win32\egg\splinter\exceptions.py to exceptions.pyc
byte-compiling build\bdist.win32\egg\splinter\meta.py to meta.pyc
byte-compiling build\bdist.win32\egg\splinter\request_handler\status_code.py to status_code.pyc
byte-compiling build\bdist.win32\egg\splinter\request_handler\__init__.py to __init__.pyc
byte-compiling build\bdist.win32\egg\splinter\utils.py to utils.pyc
byte-compiling build\bdist.win32\egg\splinter\__init__.py to __init__.pyc
creating build\bdist.win32\egg\EGG-INFO
copying splinter.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying splinter.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying splinter.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying splinter.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying splinter.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\splinter-0.7.5-py2.7.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing splinter-0.7.5-py2.7.egg
Copying splinter-0.7.5-py2.7.egg to d:\python27\lib\site-packages
Adding splinter 0.7.5 to easy-install.pth file

Installed d:\python27\lib\site-packages\splinter-0.7.5-py2.7.egg
Processing dependencies for splinter==0.7.5
Searching for selenium>=2.53.6
Reading https://pypi.python.org/simple/selenium/
Downloading https://pypi.python.org/packages/d4/0c/8429b64f9035b8db9a30c39a90fa07a460ebc4bd3639b868a1081b80a868/selenium-3.3.1.tar.gz#
Best match: selenium 3.3.1
Processing selenium-3.3.1.tar.gz
Writing c:\users\hp\appdata\local\temp\easy_install-aaaxb3\selenium-3.3.1\setup.cfg
Running selenium-3.3.1\setup.py -q bdist_egg --dist-dir c:\users\hp\appdata\local\temp\easy_install-aaaxb3\selenium-3.3.1\egg-dist-tmp
warning: no files found matching 'selenium\selenium.py'
warning: no files found matching 'LICENSE'
creating d:\python27\lib\site-packages\selenium-3.3.1-py2.7.egg
Extracting selenium-3.3.1-py2.7.egg to d:\python27\lib\site-packages
Adding selenium 3.3.1 to easy-install.pth file

Installed d:\python27\lib\site-packages\selenium-3.3.1-py2.7.egg
Finished processing dependencies for splinter==0.7.5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
(三)检验Splinter是否安装成功
在python模式下输入命令:from splinter.browser import Browser,如果没有报错,则说明安装成功! 


(四)Geckodriver驱动的安装
问题由来,如下图所示: 

从报出的异常可以看出,火狐Firefox缺少驱动Geckodriver,下面我们来安装这个Geckodriver驱动插件: 
适用版本:Firefox 48版本以及以上 
下载地址:https://github.com/mozilla/geckodriver/releases,在链接的最下面,我们选择:1.92 MBgeckodriver-v0.15.0-win64.zip进行下载。 

放置的位置:在Windows当中,将解压缩之后的Geckodriver放置到python安装的根目录(即与python.exe 同一目录)当中,此时Splinter安装完毕。 


原文:https://blog.csdn.net/a2011480169/article/details/67141540 
 

© 著作权归作者所有

莉莉不是小狐狸啊
粉丝 1
博文 10
码字总数 5674
作品 0
武汉
程序员
私信 提问
Python分布式爬虫打造搜索引擎Scrapy精讲

快乐糖果屋 三十一 Python分布式爬虫打造搜索引擎Scrapy精讲—chrome谷歌浏览器无界面运行、scrapy-splash、splinter 1、chrome谷歌浏览器无界面运行 chrome谷歌浏览器无界面运行,主要运行在...

linjin200
2018/09/07
76
0
DirectX 11 支持游戏已公布

在DirectX 10后,微软放出了DirectX 11 with Direct3D 11预览版,同时也公布了D11支持的游戏。DirectX 11主要面向Windows Vista和Windows 7,增加了很多新特性和开放式标准的支持。DirectX 1...

红薯
2009/03/31
916
0
splinter定位ntlm弹窗元素问题?

各位,splinter怎么定位这种Windows ntlm认证弹窗中的元素?

sasa001
2016/01/25
556
0
用Python开发自动化测试脚本

通常对于一个稍具规模的系统,一些新的改动势必会带来一些额外的功能回归测试工作,而这个工作是非常繁杂的,人肉的方式一次又一次的重复将会非常的枯燥乏味。而我们所希望的,是一种自动化回...

eZion
2016/04/04
161
2
亲测,手把手教你用Python抢票

大数据文摘作品,欢迎个人转发朋友圈,自媒体、媒体、机构转载务必申请授权,后台留言“机构名称+转载”,申请过授权的不必再次申请,只要按约定转载即可,但文末需放置大数据文摘二维码。 ...

moki_oschina
2015/12/11
493
0

没有更多内容

加载失败,请刷新页面

加载更多

arduino项目-1. 模拟楼道灯

@toc 1.1 情景说明 说明 漆黑的夜晚,当有人非法进入一所房屋,房屋内的灯在恰当的时间亮起,也许会有效阻止非法活动的继续。 效果展示 1.2 实验器材 器材名称 数量 继电器 1 人体红外感应器...

acktomas
11分钟前
1
0
Nacos 常见问题及解决方法

Nacos 开源至今已有一年,在这一年里,得到了很多用户的支持和反馈。在与社区的交流中,我们发现有一些问题出现的频率比较高,为了能够让用户更快的解决问题,我们总结了这篇常见问题及解决方...

阿里云官方博客
18分钟前
2
0
pinyin4j 满足中文转拼音的需求

引入依赖 // https://mvnrepository.com/artifact/com.belerweb/pinyin4j //汉字转拼音compile group: 'com.belerweb', name: 'pinyin4j', version: '2.5.1' 写入中文转拼英的工具......

edison_kwok
23分钟前
2
0
IPSE接入Substrate/Polkadot插槽实现互操作性的运行原理

Substrate框架将区块链的众多功能都模块化,对于开发者来说,只是一个选择的问题,同时还保持了众多的可以定制的功能和模块,比如底层通信模块,比如账户体系,比如共识机制等都是可以自己定...

IPSE
29分钟前
153
0
linux配置安装phpMyAdmin的步骤记录

1、首先在phpMyAdmin官方网站 http://www.phpmyadmin.net/downloads下载源码包,或者通过脚本之家进行下载://www.jb51.net/codes/405261.html ,下载后上传到服务器解压即可,或者通过Linux...

蜗牛女孩
30分钟前
3
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部