Fix switching to an alert.

This commit is contained in:
Michael Mintz 2016-05-02 19:55:55 -04:00
parent 6e84e60ba0
commit e9bb660858
1 changed files with 2 additions and 2 deletions

View File

@ -340,7 +340,7 @@ def wait_for_and_dismiss_alert(driver, timeout=settings.LARGE_TIMEOUT):
def wait_for_and_switch_to_alert(driver, timeout=settings.LARGE_TIMEOUT):
"""
Wait for a browser alert to appear, and switch to it. This should be usable
as a drop-in replacement for driver.switch_to.alert() when the alert box
as a drop-in replacement for driver.switch_to.alert when the alert box
may not exist yet.
@Params
driver - the webdriver object (required)
@ -349,7 +349,7 @@ def wait_for_and_switch_to_alert(driver, timeout=settings.LARGE_TIMEOUT):
for x in range(int(timeout * 10)):
try:
alert = driver.switch_to.alert()
alert = driver.switch_to.alert
# Raises exception if no alert present
dummy_variable = alert.text # noqa
return alert