Created
April 7, 2014 11:13
-
-
Save valera-rozuvan/10018448 to your computer and use it in GitHub Desktop.
How to add a decorator so that screenshots are taken before and after a function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_jpg(func): | |
def inner(*args, **kwargs): | |
world.browser.driver.save_screenshot(func.func_name + '.jpg') | |
return func(*args, **kwargs) | |
return inner | |
@print_jpg | |
def change_video_speed(speed): | |
world.browser.execute_script("$('.speeds').addClass('open')") | |
speed_css = 'li[data-speed="{0}"] a'.format(speed) | |
world.css_click(speed_css) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment