我正在使用 watir-webdriver,但在弹出确认窗口时遇到问题。我单击“出售”按钮,然后出现一个确认弹出窗口。我似乎无法弄清楚如何提出在弹出窗口上单击“确定”的步骤。任何帮助将非常感激。
有问题的html是:(按钮)
<button>class="btn primary" onclick="return confirm('Are you sure you wish to sell the selected loan parts?');" value="Sell Loan Parts" name="sell_loan_parts" style="" type="submit"</button>
我尝试使用以下步骤,但我想这是不正确的:
@browser.button(:onclick, "return confirm('Are you sure you wish to sell the selected loan parts?');").click
我收到的错误消息是:
Modal dialog present (Selenium::WebDriver::Error::UnhandledAlertError)
[remote server] file:///var/folders/fd/hjkxr06j6gs6620tl4k_9fh00000gn/T/webdriver-profile20121129-50930-ul24fl/extensions/fxdriver@googlecode.com/components/command_processor.js:10402:in `unknown'