Пример #1
0
def test_dismiss_alert_prompt(data):
    actions.navigate(data.env.url + 'prompt/')
    actions.click('#prompt-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', 'DISMISSED')
Пример #2
0
def test_send_text_to_alert(data):
    actions.navigate(data.env.url + 'prompt/')
    actions.click('#prompt-button')
    actions.send_text_to_alert('hey, some text')
    golem_steps.assert_last_step_message("Send 'hey, some text' to alert")
    actions.accept_alert()
    actions.verify_element_text('#result', 'hey, some text')
Пример #3
0
def test_submit_prompt_alert(data):
    actions.navigate(data.env.url + 'prompt/')
    actions.click('#prompt-button')
    actions.submit_prompt_alert('hey, some text')
    golem_steps.assert_last_step_message(
        "Submit alert with text 'hey, some text'")
    actions.verify_element_text('#result', 'hey, some text')
Пример #4
0
def test_dismiss_alert_confirm(data):
    actions.navigate(data.env.url + 'confirm/')
    actions.click('#confirm-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', 'NOT CONFIRMED')
def test(data):
    actions.navigate(data.env.url+'elements/')
    actions.verify_element_text('#link1', 'this is a link to index')
    try:
        actions.verify_element_text('#link1', 'incorrect text')
    except Exception as e:
        assert "expected element #link1 text to be 'incorrect text' but was 'this is a link to index'" in e.args[0]
Пример #6
0
def test_dismiss_alert(data):
    actions.navigate(data.env.url+'alert/')
    actions.click('#alert-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
    golem_steps.assert_last_step_message('Dismiss alert')
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', '1')
Пример #7
0
def test_accept_alert(data):
    # alert
    actions.navigate(data.env.url + 'alert/')
    actions.click('#alert-button')
    actions.verify_alert_present()
    actions.accept_alert()
    assert golem_logger.last_info_log_line_contains('Accept alert')
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', '1')
    # confirm
    actions.navigate(data.env.url + 'confirm/')
    actions.click('#confirm-button')
    actions.verify_alert_present()
    actions.accept_alert()
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', 'CONFIRMED')
    # prompt
    actions.navigate(data.env.url + 'prompt/')
    actions.click('#prompt-button')
    actions.verify_alert_present()
    actions.accept_alert()
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', 'EMPTY')
def test(data):
    # switch to iframe by frame name
    actions.navigate(data.env.url + 'iframes/')
    actions.switch_to_frame('iframe-top')
    actions.verify_page_contains_text('IFrame Top')
    actions.verify_page_not_contains_text('IFrames')
    actions.click('#button-top')
    actions.verify_element_text('#button-top-result', 'Clicked!')
    # switch to iframe by index
    actions.navigate(data.env.url + 'iframes/')
    actions.switch_to_frame(1)
    actions.verify_page_contains_text('IFrame Bottom')
    actions.verify_page_not_contains_text('IFrames')
    actions.click('#button-bottom')
    actions.verify_element_text('#button-bottom-result', 'Clicked!')
    # switch to iframe by webelement
    actions.navigate(data.env.url + 'iframes/')
    frame_element = actions.get_browser().find('#iframeBottom')
    actions.switch_to_frame(frame_element)
    actions.verify_page_contains_text('IFrame Bottom')
    actions.verify_page_not_contains_text('IFrames')
    actions.click('#button-bottom')
    actions.verify_element_text('#button-bottom-result', 'Clicked!')
Пример #9
0
def test(data):
    # alert
    actions.navigate(data.env.url + 'alert/')
    actions.click('#alert-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
    golem_steps.assert_last_step_message('Dismiss alert')
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', '1')
    # confirm
    actions.navigate(data.env.url + 'confirm/')
    actions.click('#confirm-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', 'NOT CONFIRMED')
    # prompt
    actions.navigate(data.env.url + 'prompt/')
    actions.click('#prompt-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
    actions.verify_alert_not_present()
    actions.verify_element_text('#result', 'DISMISSED')
Пример #10
0
def test(data):
    # switch to frame by frame name
    actions.navigate(data.env.url+'frames/')
    actions.switch_to_frame('frame-top')
    actions.verify_page_contains_text('Top')
    actions.verify_page_not_contains_text('Bottom Right')
    actions.click('#button-top')
    actions.verify_element_text('#button-top-result', 'Clicked!')
    # switch to frame by index
    actions.navigate(data.env.url + 'frames/')
    actions.switch_to_frame(0)
    golem_steps.assert_last_step_message('Switch to frame 0')
    actions.verify_page_contains_text('Top')
    actions.verify_page_not_contains_text('Bottom Right')
    actions.click('#button-top')
    actions.verify_element_text('#button-top-result', 'Clicked!')
    # switch to frame by webelement
    actions.navigate(data.env.url + 'frames/')
    frame_element = actions.get_browser().find('#frameTop')
    actions.switch_to_frame(frame_element)
    actions.verify_page_contains_text('Top')
    actions.verify_page_not_contains_text('Bottom Right')
    actions.click('#button-top')
    actions.verify_element_text('#button-top-result', 'Clicked!')
Пример #11
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.javascript_click(('id', 'button-one'))
    golem_steps.assert_last_step_message('Javascript click element button-one')
    actions.verify_element_text(('id', 'button-one-result'), 'Clicked!')
Пример #12
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    element = actions.get_browser().find('#button-one')
    element.javascript_click()
    actions.verify_element_text(('id', 'button-one-result'), 'Clicked!')
Пример #13
0
def test_press_key(data):
    actions.navigate(data.env.url + 'elements/')
    element = actions.get_browser().find('#input-one')
    element.press_key('NUMPAD2')
    actions.wait(0.5)
    actions.verify_element_text('#input-one-input-result', 'Welcome 2')