Skip to content

Commit

Permalink
Handle FramesChangedWhileIterating in wait_until
Browse files Browse the repository at this point in the history
If the frames change while iterating, then we wait and try again later.
  • Loading branch information
mherrmann committed Jul 23, 2024
1 parent 1f390b2 commit db18980
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions helium/_impl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,11 @@ def wait_until_impl(self, condition_fn, timeout_secs=10, interval_secs=0.5):
condition_fn = condition_fn.__call__
args_spec = getfullargspec(condition_fn).args
unfilled_args = len(args_spec)
condition = \
condition_fn if unfilled_args else lambda driver: condition_fn()
def condition(driver):
try:
return condition_fn(driver) if unfilled_args else condition_fn()
except FramesChangedWhileIterating:
return False
wait = WebDriverWait(
self.require_driver().unwrap(), timeout_secs,
poll_frequency=interval_secs
Expand Down

0 comments on commit db18980

Please sign in to comment.