lettuce的Selenium WebDriver扩展
项目描述
lettuce_webdriver为使用Cucumber BDD Python端口lettuce和selenium 2.8或更高版本Python包提供了一组步骤。
包含的匹配器和语法主要受到cucumber_watir的启发。
要求
设置lettuce_webdriver
在您的lettuce terrain.py 文件中,添加一个包含语句,让lettuce了解由 lettuce_webdriver 提供的附加步骤定义,并创建所需selenium浏览器的设置
from lettuce import before, world from selenium import webdriver import lettuce_webdriver.webdriver @before.all def setup_browser(): world.browser = webdriver.Firefox()
用法
lettuce故事使用标准Cucumber风格的gherkin编写。例如
Scenario: Filling out the signup form Given I go to "http://foo.com/signup" When I fill in "Name" with "Foo Bar" And I fill in "Email" with "nospam@gmail.com" And I fill in "City" with "San Jose" And I fill in "State" with "CA" And I uncheck "Send me spam!" And I select "Male" from "Gender" And I press "Sign up" Then I should see "Thank you for signing up!"
包含的匹配器
以下lettuce步骤匹配器包含在此软件包中,可以根据需要与Given/When/Then/And一起使用。
# urls I visit "http://google.com/" I go to "http://google.com/" # links I click "Next page" I should see a link with the url "http://foobar.com/" I should see a link to "Google" with the url "http://google.com/" I should see a link that contains the text "Foobar" and the url "http://foobar.com/" # general I should see "Page Content" I see "Page Content" I should see "Page Content" within 4 seconds I should not see "Foobar" I should be at "http://foobar.com/" I should see an element with id of "http://bar.com/" I should see an element with id of "http://bar.com/" within 2 seconds I should not see an element with id of "http://bar.com/" The element with id of "cs_PageModeContainer" contains "Read" The element with id of "cs_BigDiv" does not contain "Write" # browser The browser's URL should be "http://bar.com/" The browser's URL should contain "foo.com" The browser's URL should not contain "bar.com" # forms I should see a form that goes to "http://bar.com/submit.html" I press "Submit" # checkboxes I check "I have a car" I uncheck "I have a bus" The "I have a car" checkbox should be checked The "I have a bus" checkbox should not be checked # select I select "Volvo" from "Car Choices" I select the following from "Car Choices": """ Volvo Saab """ The "Volvo" option from "Car Choices" should be selected The following options from "Car Choices" should be selected: """ Volvo Saab """ # radio buttons I choose "Foobar" The "Foobar" option should be chosen The "Bar" option should not be chosen # text entry fields (text, textarea, password) I fill in "Username" with "Smith"
支持
lettuce_webdriver 由 Nick Pilon (@npilon 在 github 上和 npilon@lexmachina.com) 维护。可以通过 github pull requests 提交错误修复和功能补丁,以及通过 github issues 提交错误报告或功能请求。
0.3.5
捕获屏幕截图的步骤
0.3.4
依赖于可安装的 sure 版本
lettuce_webdriver django 步骤的错误修复 (danni)
帧选择步骤 (danni)
更新的 selenium 依赖
更好的 jQuery 自动魔法
0.3.3
使用 JQuery 查找元素的步骤的相对完整的集合
各种错误修复
0.2.1
修复 0.2 版本的守卫,与最近的 selenium 版本不兼容。
0.2
添加一个守卫,如果字段未找到则正确失败。
API 更改:wait_for_content 现在期望步骤作为第一个参数
0.1.3
添加了 “应在 X 秒内看到“..”” 步骤。
添加了 “应在 2 秒内看到具有 id 为 “http://bar.com/” 的元素”。
0.1.2
更新了 “press” 步骤,使其不需要 “When”
0.1.1
修复了密码字段无法找到的错误。
0.1
初始版本
项目详情
lettuce_webdriver-0.3.5.tar.gz 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 836d7b330f885a282f163d5c63d6847c0d3afb7a3276fb71ce1d2fdee9ad20e8 |
|
MD5 | 908e98cec8f3b9ed2d333cc92091294b |
|
BLAKE2b-256 | 4c5223b84d1887fb217fb37727e4c9fb9e28ab2ab7262c15d833d487ceac3239 |