我想知道有没有办法在警报窗口上选择(单击)取消按钮?
我用了:
@browser.choose_cancel_on_next_confirmation()
@browser.click("//td[text() = 'mailik@mm.com']/../td//a[text()='Delete']")
Without knowing anything else and assuming you're now working with selenium webdriver 2...
I'm assuming @browser is the webdriver object...
You need to use the switch_to method to change focus to the alert box and dismiss it
alert = @browser.switch_to.alert
alert.dismiss