Advertisement
maurobaraldi

Lettuce step example

Jun 4th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. from lettuce import *
  3. from splinter import Browser
  4.  
  5.  
  6. @before.each_feature
  7. def set_browser(feature):
  8.     world.browser = Browser('firefox')
  9.  
  10.  
  11. @step(u'I go to the "(.*)"')
  12. def when_i_go_to_the_url(step, url):
  13.     world.response = world.browser.visit(url)
  14.  
  15.  
  16. @step(u'I click in button with id "([^"]*)"')
  17. def i_click_in_button_with_value(step, button):
  18.     world.browser.find_by_id(button).first.click()
  19.  
  20.  
  21. @step(u'I see that page contains "([^"]*)"')
  22. def i_see_that_page_contains_in(step, text):
  23.     if not world.browser.is_text_present(text):
  24.         raise Exception("%s was not found in this page ;(" % text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement