Hegwin.Me

The hydra-universe twisting its body scaled in stars.

How to handle javascript confirm with selennium webdriver

Selenium driver 对 JS Confirm 的处理

JS popup confirmation box is often used in web development, how does the feature test script handle this popup box?

# ruby
page.driver.browser.switch_to.alert.accept # => click OK

page.driver.browser.switch_to.alert.dismiss # => click Cancel

page.driver.browser.switch_to.alert.text #=> return popup text

Reference: selenium-webdriver documentation

< Back