I'm looking for an opportunity to send "Enter" key to browser window, not to web element(to confirm the appearing save dialog). Is it possible?
Asked
Active
Viewed 3,146 times
1
-
Is the save dialog appearing as an alert? – Brydenr Sep 15 '16 at 17:43
-
Could you share this dialog HTML if it's not a JavaScript dialog?? – Saurabh Gaur Sep 15 '16 at 18:04
-
The save dialog is standart firefox' save dialog – Omkommersind Sep 15 '16 at 18:45
-
1Seems to be similar http://stackoverflow.com/questions/1176348/access-to-file-download-dialog-in-firefox and http://stackoverflow.com/questions/24852709/how-do-i-automatically-download-files-from-a-pop-up-dialog-using-selenium-python – grunge_scum Sep 16 '16 at 07:13
1 Answers
1
This is in python, but other language will be similar. You should be able to use driver.switch_to.alert
when the alert appears, which returns the alert
object. If you just want to confirm the alert, use driver.switch_to.alert.accept()
. Sending the enter
key would be:
from selenium.webdriver.common.keys import Keys
# Get to stage where alert appears
# Send enter key
driver.switch_to.alert.send_keys(Keys.ENTER)
You may need to use Expected Conditions to wait for the alert to actually appear.

Brydenr
- 798
- 1
- 19
- 30