Skip to content

Commit

Permalink
[py] Initialize Alert object by calling alert.text (#1863)
Browse files Browse the repository at this point in the history
this is how it's done in the Java client, and makes sense as you would want to fail, or have your alert reference as early as possible
  • Loading branch information
Mobrockers authored and lmtierney committed Dec 6, 2017
1 parent d1f4f50 commit eab402f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion py/selenium/webdriver/remote/switch_to.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def alert(self):
:Usage:
alert = driver.switch_to.alert
"""
return Alert(self._driver)
alert = Alert(self._driver)
alert.text
return alert

def default_content(self):
"""
Expand Down
1 change: 0 additions & 1 deletion py/selenium/webdriver/support/expected_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ def __init__(self):
def __call__(self, driver):
try:
alert = driver.switch_to.alert
alert.text
return alert
except NoAlertPresentException:
return False
Expand Down

0 comments on commit eab402f

Please sign in to comment.