0

我想知道有没有办法在警报窗口上选择(单击)取消按钮?

我用了:

@browser.choose_cancel_on_next_confirmation()
@browser.click("//td[text() = 'mailik@mm.com']/../td//a[text()='Delete']")
4

1 回答 1

0

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

http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/WebDriver/Alert.html#dismiss-instance_method

于 2012-10-28T20:05:10.067 回答