Retry on stale element reference to avoid race conditions while interface is not ready yet.
This commit is contained in:
parent
ba9845cb68
commit
7f4c540fa0
1 changed files with 6 additions and 0 deletions
|
@ -570,6 +570,8 @@ class TestCase < Test::Unit::TestCase
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def exists(params)
|
def exists(params)
|
||||||
|
retries ||= 0
|
||||||
|
|
||||||
switch_window_focus(params)
|
switch_window_focus(params)
|
||||||
log('exists', params)
|
log('exists', params)
|
||||||
|
|
||||||
|
@ -589,6 +591,10 @@ class TestCase < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
||||||
|
sleep retries
|
||||||
|
retries += 1
|
||||||
|
retry if retries < 3
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
Loading…
Reference in a new issue