コード例 #1
0
def test(data):
    actions.navigate(data.env.url + 'special-elements/')
    actions.verify_page_contains_text('Special Elements')
    try:
        actions.verify_page_contains_text('THIS TEXT IS NOT PRESENT')
    except Exception as e:
        assert "Text 'THIS TEXT IS NOT PRESENT' not found in page" in e.args[0]
コード例 #2
0
def test(data):
    actions.navigate(data.env.url + 'special-elements/')
    actions.verify_page_contains_text('Special Elements')
    golem_steps.assert_last_step_message(
        "Verify 'Special Elements' is present in the page")
    actions.verify_page_contains_text('THIS TEXT IS NOT PRESENT')
    golem_steps.assert_last_error(
        "text 'THIS TEXT IS NOT PRESENT' not found in the page")
コード例 #3
0
def test(data):
    # switch to iframe by frame name
    actions.navigate(data.env.url + 'iframes/')
    actions.switch_to_frame('iframe-bottom')
    actions.switch_to_frame('iframe-bottom-left')
    actions.verify_page_contains_text('IFrame Bottom Left')
    actions.verify_page_not_contains_text('IFrames')
    actions.verify_page_not_contains_text('id="button-bottom"')
    # switch to default content
    actions.switch_to_default_content()
    actions.verify_page_contains_text('IFrames')
    actions.verify_page_not_contains_text('IFrame Bottom')
    actions.verify_page_not_contains_text('IFrame Bottom Left')
コード例 #4
0
def test(data):
    actions.navigate(data.env.url+'iframes/')
    # switch to iframe
    actions.switch_to_frame('iframe-bottom')
    actions.verify_page_contains_text('IFrame Bottom')
    actions.verify_page_not_contains_text('Iframes')
    # switch to nested iframe
    actions.switch_to_frame('iframe-bottom-left')
    actions.verify_page_contains_text('IFrame Bottom Left')
    actions.verify_page_not_contains_text('Iframe Bottom')
    # switch back to parent iframe
    actions.switch_to_parent_frame()
    actions.verify_page_contains_text('IFrame Bottom')
    actions.verify_page_not_contains_text('Iframe Bottom Left')
    actions.verify_page_not_contains_text('IFrames')
    # switch back to main content
    actions.switch_to_parent_frame()
    actions.verify_page_contains_text('IFrames')
    actions.verify_page_not_contains_text('IFrame Bottom')
    actions.verify_page_not_contains_text('Iframe Bottom Left')
コード例 #5
0
def test_switch_to_default_content_frame(data):
    # switch to frame
    actions.navigate(data.env.url + 'frames/')
    # first frame in frameset is considered main content
    actions.verify_page_contains_text('Top')
    actions.switch_to_frame('frame-bottom')
    # switch to nested frame
    actions.switch_to_frame('frame-bottom-left')
    actions.verify_page_contains_text('Bottom Left')
    actions.verify_page_not_contains_text('Top')
    actions.verify_page_not_contains_text('Bottom Right')
    # switch back to parent frame
    actions.switch_to_parent_frame()
    actions.switch_to_parent_frame()
    actions.verify_page_contains_text('Top')
    actions.verify_page_not_contains_text('Bottom Right')
    actions.verify_page_not_contains_text('Bottom Left')
コード例 #6
0
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!')
コード例 #7
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!')