Ruby watir webdriver模式对话框错误
单击此链接时Ruby watir webdriver模式对话框错误,ruby,watir,watir-webdriver,Ruby,Watir,Watir Webdriver,单击此链接时 [remote server] file:///C:/Users/abdia/AppData/Local/Temp/webdriver-profile20120 326-6092-6x0lwb/extensions/fxdriver@googlecode.com/components/command_processor. js:10583:in `unknown': Modal dialog present (Selenium::WebDriver::Error::Unhandl
[remote server] file:///C:/Users/abdia/AppData/Local/Temp/webdriver-profile20120
326-6092-6x0lwb/extensions/fxdriver@googlecode.com/components/command_processor.
js:10583:in `unknown': Modal dialog present (Selenium::WebDriver::Error::Unhandl
edAlertError)
您也可以尝试直接使用WebDriver处理
require "watir-webdriver/extensions/alerts"
browser.confirm(true) do
browser.link(text: 'Delete').click
end
使用基于WebDriver的解决方案更新了答案,直到使用Modal dialog Present崩溃,我刚刚在本地进行了测试,结果正常。当确认对话框出现时,您必须显示使用您的Watir代码和点。单击链接后失败?如果是,单击后您会做什么?对不起,那是更新的WATIR定位器吗example@dai.co.uk'?). 除非这是伪代码,否则它无法定位您要查找的内容。是的,抱歉,这只是一个示例
<a href="/users/1" class="ahmet.abdi@dai.co.uk" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete</a>
b.a(:class => 'example@dai.co.uk').click
require "watir-webdriver/extensions/alerts"
browser.confirm(true) do
browser.link(text: 'Delete').click
end
browser.link(text: 'Delete').click
# when modal dialog is shown
browser.driver.switch_to.alert.dismiss