Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple test using behave and selenium
from selenium import webdriver
def before_all(context):
context.browser = webdriver.Firefox()
def after_all(context):
context.browser.quit()
Feature: testing browser title
Scenario Outline: visit <browser page> and check
When we visit <browser page>
Then it should have a title "<browser title>"
Examples: Browser
| browser page | browser title |
| https://crash-stats.mozilla.com/ | Crash Data for Firefox |
@when('we visit https://crash-stats.mozilla.com/')
def step(context):
context.browser.get("https://crash-stats.mozilla.com/")
@then('it should have a title "Crash Data for Firefox"')
def step(context):
assert context.browser.title == "Crash Data for Firefox"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment