-
Splinter
鎖定
Splinter是一個使用Python開發的開源Web應用測試工具。它可以幫你實現自動瀏覽站點和與其進行交互。
- 外文名
- Splinter
- 類 別
- 應用測試工具
- 定 義
- 使用Python開發的開源Web應用測試工具
Splinter簡介
Splinter(至2016年12月,最新版本為0.7.5)。
Splinter對已有的自動化工具(如:Selenium、PhantomJS和zope.testbrowser)進行抽象,形成一個全新的上層應用API,它使為Web應用編寫自動化測試腳本變的更容易。
Splinter依賴包
Splinter0.7.2依賴以下包:
Selenium(版本>=2.44.0)
Django(版本>=1.5.8,<1.7)
Flask(版本>=0.10)
lxml(版本>=2.3.6)
zope.testbrowser(版本>=4.0.4)
cssselect
Splinter代碼示例
使用示例
from splinter import Browser with Browser() as browser: # Visit URL url = "搜索引擎" browser.visit(url) browser.fill('q', 'splinter - python acceptance testing for web applications') # Find and click the 'search' button button = browser.find_by_name('btnG') # Interact with elements button.click() if browser.is_text_present('splinter.readthedocs.org'): print "Yes, the official website was found!" else: print "No, it wasn't found... We need to improve our SEO techniques"
與Selenium的比較
使用Splinter填充一個form的字段如下:
browser.fill('username', 'janedoe')
而使用Selenium需要:
elem = browser.find_element.by_name('username') elem.send_keys('janedoe')
- 詞條統計
-
- 瀏覽次數:次
- 編輯次數:7次歷史版本
- 最近更新: 亡命听