我正在努力编写测试;其中我想检查是否存在警报,检查其文本是否存在并接受它。如何使用nodejs webdriver检查警报是否打开(wd)
我查How to wait for an alert in Selenium webdriver ?,How to check if an alert exists using WebDriver?和selenium 2.4.0, how to check for presence of an alert,但我不能使用https://github.com/admc/wd
我写的东西沿着
browser.alertText(function (err, text) {
if (text) {
browser.acceptAlert(function() {
// ...
});
}
});
它可以显示报警时,大大好去适应它,但alertText
时挂起没有警报窗口。
如何在发出alertText
之前检查警报是否存在?
感谢您的帮助,
它对我来说非常合适!谢谢! – daronwolff