-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
In each class that inherits from DysonModule, is still required to have a decent chunk of code.
from dyson.errors import DysonError
from dyson.utils.module import DysonModule
from dyson.utils.selectors import translate_selector
class ClickModule(DysonModule):
def run(self, webdriver, params):
"""
Click an element on the page
:param webdriver:
:param params:
:return:
"""
if len(params.keys()) > 0:
selector, strategy = translate_selector(params, webdriver)
if selector and strategy:
return selector(strategy).click()
else:
raise DysonError("You need to specify a valid selector to click")
else:
raise DysonError("You need to specify an argument to \"click\"")we could optimize this by creating some sort of get_param('param') and have it throw errors or return. we could even have it default . get_param('param', 'default')
Metadata
Metadata
Assignees
Labels
No labels