예제 #1
0
def test(data):
    actions.navigate(data.env.url+'tabs/')
    actions.send_keys('#urlInput', '/elements/')
    actions.click("#goButton")
    actions.clear_element('#urlInput')
    actions.send_keys('#urlInput', '/alert/')
    actions.click("#goButton")
    actions.switch_to_window_by_index(0)
    first_title = actions.get_window_title()
    actions.switch_to_window_by_index(1)
    second_title = actions.get_window_title()
    actions.switch_to_window_by_index(2)
    third_title = actions.get_window_title()
    actions.switch_to_window_by_index(0)
    # close third window by title
    actions.get_browser().close_window_by_title(third_title)
    actions.verify_amount_of_windows(2)
    actions.verify_title(first_title)
    # close first window by title, from the first window
    actions.get_browser().close_window_by_title(first_title)
    # second window is now active
    actions.verify_amount_of_windows(1)
    actions.verify_title(second_title)
    # try to close a window that is not present
    msg = "a window with title 'Incorrect Title' was not found"
    with expected_exception(Exception, msg):
        actions.get_browser().close_window_by_title('Incorrect Title')
예제 #2
0
def test(data):
    actions.navigate(data.env.url + 'tabs/')
    actions.send_keys('#urlInput', '/elements/')
    actions.click("#goButton")
    actions.clear_element('#urlInput')
    actions.send_keys('#urlInput', '/alert/')
    actions.click("#goButton")
    actions.switch_to_window_by_index(0)
    first_title = actions.get_window_title()
    actions.switch_to_window_by_index(1)
    second_title = actions.get_window_title()
    actions.switch_to_window_by_index(2)
    third_title = actions.get_window_title()
    actions.switch_to_window_by_index(0)
    actions.get_browser().switch_to_next_window()
    actions.verify_title(second_title)
    actions.get_browser().switch_to_next_window()
    actions.verify_title(third_title)
    actions.get_browser().switch_to_next_window()
    actions.verify_title(first_title)
예제 #3
0
def test(data):
    actions.navigate(data.env.url + 'tabs/')
    actions.send_keys('#urlInput', '/elements/')
    actions.click("#goButton")
    actions.clear_element('#urlInput')
    actions.send_keys('#urlInput', '/alert/')
    actions.click("#goButton")
    actions.switch_to_window_by_index(0)
    first_title = actions.get_window_title()
    actions.switch_to_window_by_index(1)
    second_title = actions.get_window_title()
    actions.switch_to_window_by_index(0)
    # close third window by index
    actions.get_browser().close_window_by_index(2)
    actions.verify_amount_of_windows(2)
    actions.verify_title(first_title)
    # close first window by index, from the first window
    actions.get_browser().close_window_by_index(0)
    actions.verify_amount_of_windows(1)
    # second window is now index 0
    actions.verify_title(second_title)
예제 #4
0
def test(data):
    actions.navigate(data.env.url + 'tabs/')
    actions.send_keys('#urlInput', '/elements/')
    actions.click("#goButton")
    actions.clear_element('#urlInput')
    actions.send_keys('#urlInput', '/alert/')
    actions.click("#goButton")
    actions.switch_to_window_by_index(0)
    first_title = actions.get_window_title()
    actions.switch_to_window_by_index(1)
    second_title = actions.get_window_title()
    actions.switch_to_window_by_index(2)
    third_title = actions.get_window_title()
    actions.switch_to_window_by_index(2)
    actions.verify_title(third_title)
    actions.switch_to_previous_window()
    golem_steps.assert_last_step_message('Switch to previous window')
    actions.verify_title(second_title)
    actions.switch_to_previous_window()
    actions.verify_title(first_title)
    actions.switch_to_previous_window()
    actions.verify_title(third_title)
예제 #5
0
def test(data):
    actions.navigate(data.env.url)
    assert actions.get_window_title() == 'Web Playground'
    actions.navigate(data.env.url + 'elements/')
    assert actions.get_window_title() == 'Web Playground - Elements'