Skip to content

Commit 60299ea

Browse files
Align Send Alert Text with Element Send Keys
The WebDriver specification has been updated to align Send Alert Text and Element Send Keys so they both send the same key and value structure simplifying send keys between the two.
1 parent 352e5da commit 60299ea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

py/selenium/webdriver/common/alert.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
The Alert implementation.
2020
"""
2121

22+
from selenium.webdriver.common.utils import keys_to_typing
2223
from selenium.webdriver.remote.command import Command
2324

2425

@@ -88,7 +89,10 @@ def send_keys(self, keysToSend):
8889
8990
9091
"""
91-
self.driver.execute(Command.SET_ALERT_VALUE, {'text': keysToSend})
92+
if self.driver.w3c:
93+
self.driver.execute(Command.SET_ALERT_VALUE, {'value': keys_to_typing(keysToSend)})
94+
else:
95+
self.driver.execute(Command.SET_ALERT_VALUE, {'text': keysToSend})
9296

9397
def authenticate(self, username, password):
9498
"""

0 commit comments

Comments
 (0)