lettuce_webdriver provides a set of steps for use with the Cucumber BDD Python port lettuce using the selenium 2.8 or higher Python package.
The included matchers and syntax is inspired heavily by cucumber_watir.
Requirements
Setting Up lettuce_webdriver
In your lettuce terrain.py file, add an include statement for lettuce to learn about the additional step definitions provided by lettuce_webdriver and a setup that creates the selenium browser desired:
from lettuce import before, world
from selenium import webdriver
import lettuce_webdriver.webdriver
@before.all
def setup_browser():
world.browser = webdriver.Firefox()
Usage
lettuce stories are written in the standard Cucumber style of gherkin. For example:
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!"
Included Matchers
The following lettuce step matchers are included in this package and can be used with Given/When/Then/And as desired.
# 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"
Support
lettuce_webdriver is maintained by Nick Pilon (@npilon on github and npilon@lexmachina.com). Bug fixes and feature patches may be submitted using github pull requests, and bug reports or feature requests as github issues.
0.3.5
Steps for capturing screenshots
0.3.4
Depend on an installable version of sure
Bugfixes to lettuce_webdriver django steps (danni)
Steps for frame selection (danni)
Newer selenium dependency
Better jQuery automagic
0.3.3
Reasonably complete selection of steps that use JQuery to find elements.
Assorted bug-fixes
0.2.1
Fix the guard from 0.2, incompatible with recent selenium versions.
0.2
Adding a guard to fail properly if the field is not found.
API change: wait_for_content now expects a step as the first parameter
0.1.3
Added ‘I should see “..” within X seconds’ step.
Added ‘I should see an element with id of “http://bar.com/” within 2 seconds’.
0.1.2
Updated “press” step so it doesn’t require ‘When’
0.1.1
Fix bug with password field failing to be found.
0.1
Initial version
Metadata
Release files for lettuce_webdriver 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lettuce_webdriver-0.3.5.tar.gz | 17.4 kB | Without provenance | Details |
Release files / lettuce_webdriver-0.3.5.tar.gz
| Download URL | lettuce_webdriver-0.3.5.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
836d7b330f885a282f163d5c63d6847c0d3afb7a3276fb71ce1d2fdee9ad20e8
|
|
BLAKE2b-256 checksum How to use checksums |
4c5223b84d1887fb217fb37727e4c9fb9e28ab2ab7262c15d833d487ceac3239
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for lettuce_webdriver 0.3.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.