Skip to content

Commit

Permalink
reset for stale elements
Browse files Browse the repository at this point in the history
  • Loading branch information
lmtierney committed Jun 1, 2018
1 parent 7bfda7d commit 4658006
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions nerodia/elements/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def visible(self):
self.assert_exists()
return self.el.is_displayed()
except StaleElementReferenceException:
self.reset()
raise self._unknown_exception

@property
Expand Down
4 changes: 4 additions & 0 deletions tests/wait_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ def test_waits_until_the_element_appears(self, browser):
browser.link(id='show_bar').click()
browser.div(id='bar').wait_until_present(timeout=5)

def test_waits_until_the_element_reappears(self, browser):
browser.link(id='readd_bar').click()
browser.div(id='bar').wait_until_present()

def test_times_out_if_the_element_doesnt_appear(self, browser):
message = 'timed out after 1 seconds, waiting for true condition on present'
with pytest.raises(TimeoutError) as e:
Expand Down

0 comments on commit 4658006

Please sign in to comment.