예제 #1
0
def test_is_not_displayed_when_dom_element_is_stale_and_no_more_present(
        browser, stale_dom_element):
    browser.find_elements_by_xpath.side_effect = ([stale_dom_element], [])
    el = WebElement(browser, "some_tag[@some_attr='some_value']")
    el._find_dom_element = Mock(wraps=el._find_dom_element)  # pylint: disable=protected-access
    assert el.dom_element is stale_dom_element
    assert not el.is_displayed()
    assert el._find_dom_element.call_count == 2  # pylint: disable=protected-access
    stale_dom_element.is_displayed.assert_called_once()
예제 #2
0
def test_is_displayed(browser, displayed_dom_element):
    browser.find_elements_by_xpath = Mock(return_value=[displayed_dom_element])
    el = WebElement(browser, "some_tag[@some_attr='some_value']")
    assert el.is_displayed()
예제 #3
0
def test_is_not_displayed_when_dom_element_is_not_present(browser):
    browser.find_elements_by_xpath = Mock(return_value=[])
    el = WebElement(browser, "some_tag[@some_attr='some_value']")
    assert not el.is_displayed()