1

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?

Omkommersind
  • 276
  • 5
  • 13

1 Answers1

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