hound icon indicating copy to clipboard operation
hound copied to clipboard

Check if javascript alert is open

Open acrogenesis opened this issue 7 years ago • 1 comments

Can't find on the documentation a function to check if an alert is open, if I try to dismiss and it's not present it crashes

** (RuntimeError) no alert open
  (Session info: chrome=65.0.3325.181)
  (Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.13.4 x86_64)
    (hound) lib/hound/request_utils.ex:57: Hound.RequestUtils.handle_response/3

acrogenesis avatar Apr 04 '18 17:04 acrogenesis

This is what I came up with, but don't know if there's a better way.

try do
  accept_dialog()
rescue
  RuntimeError -> "Dialog not open"
end

acrogenesis avatar Apr 04 '18 17:04 acrogenesis