我正在调整我的回归测试以在 Firefox 中测试 Web 应用程序。最大的绊脚石似乎是如何在 Firefox 中自动化模态对话框。
在 ie 中,我使用以下脚本的变体,但它在 Firefox 中不起作用。是否有替代方案适用于 ie 和 firefox?
popup=Thread.new {
autoit=WIN32OLE.new('AutoItX3.Control')
ret=autoit.WinWait(title,"",60)
if (ret==1)
puts "There is popup."
autoit.WinActivate(title)
button.downcase!
if button.eql?("ok") || button.eql?("yes") || button.eql?("continue")
autoit.Send("{Enter}")
else
autoit.Send("{tab}")
autoit.Send("{Enter}")
end
elsif (ret==0)
puts "No popup, please check your code."
end
}
at_exit { Thread.kill(popup) }
end
button.click_no_wait
check_for_popups("Message from webpage", "OK")