Unreviewed. Update W3C WebDriver imported tests.
[WebKit-https.git] / WebDriverTests / imported / w3c / webdriver / tests / element_click / stale.py
1 import pytest
2 import webdriver
3
4 from tests.support.asserts import assert_error
5 from tests.support.inline import inline
6
7
8 def click_element(session, element):
9     return session.transport.send(
10         "POST", "/session/{session_id}/element/{element_id}/click".format(**{
11             "session_id": session.session_id,
12             "element_id": element.id,
13         }))
14
15
16 def test_is_stale(session):
17     session.url = inline("<button>foo</button>")
18     button = session.find.css("button", all=False)
19     session.url = inline("<button>bar</button>")
20
21     response = click_element(session, button)
22     assert_error(response, "stale element reference")