def fn(entity: Browser): entity.element('[href*=notification_message]').click() notification = entity.element('#flash') webelement = notification() actual = webelement.text expected = message if actual != expected: raise AssertionError(f'notification message was wrong:' f'\texpected: {expected}' f'\t actual: {actual}')
def fn(entity: Browser) -> None: size = len(browser.all("#todo-list>li")) produced_enough = size >= number if not produced_enough: entity.element('#new-todo').type('one more').press_enter() raise AssertionError(f'actual produced todos were: {size}')
from selene import Browser, Config from selenium.webdriver import Firefox """ Element """ browser = Browser( Config( driver=Firefox(), base_url='https://google.com', timeout=30 ) ) browser.open('') # browser.element('input[name="q"]').type('live de python') browser.element('//*[@name="q"]').type('live de python').press_enter()