def test_type_value(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(LoginPanel) assert (panel.get_attribute('name', 'value') == 'John') panel.clear('name') panel.type('name', 'xuzg') assert (panel.get_attribute('name', 'value') == 'xuzg')
def test_get_element_by_name(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(ClickPanel) element = panel.get_element_by_name('jump') assert (isinstance(element, WebElement))
def test_outer_html(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(ClickPanel) outer_html = panel.outer_html('jump') assert ('id="jump"' in outer_html) assert ('a href=' in outer_html)
def test_find_ui_node(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test.html') panel = fixture_session.wait_for(PostPanel1) node = panel.find_ui_node('post1') assert (node['selector'] == 'body div:nth-child(1)') assert (node['name'] == 'post1')
def test_text_of(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(ClickPanel) text = panel.text_of('double') assert (text == 'Double-click me')
def test_mouse_over(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(MouseOverPanel) panel.hover('hover') assert (panel.text_of('hover') == 'I was Mouse-over!')
def test_page_jump_new(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(ClickPanel) panel.click('jump new') assert (panel.context.browser.current_url == 'file:///D:/code/ppo/test.html')
def test_double_click_element(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(ClickPanel) assert (panel.text_of('double') == 'Double-click me') panel.double_click('double') assert (panel.text_of('double') == 'I was double-clicked!')
def test_wait_for_element_locate_with_css_selector(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(ClickPanel) panel.wait_for_all_element_locate(css_selector='#single_click')
def test_wait_for_element_locate_with_name(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(ClickPanel) panel.wait_for_all_element_locate(name='single')
def test_get_attributes(fixture_session: Context): fixture_session.browser.get('file:///D:/code/ppo/test/html/click_test.html') panel = fixture_session.wait_for(ClickPanel) attrs = panel.get_attributes('single') assert (attrs['id'] == 'single_click') assert (attrs['onclick'] == 'SingleClick()')