在使用 watir safari webdriver 时,webdriver 在遇到警报弹出窗口时会立即终止。是否有任何变通方法可以让 Safari webdriver 与警报一起正常运行,或者完全阻止警报出现?
$driver.button(:xpath, "//button[@class='btn btn-success btn-success-red']").wait_until_present
$driver.button(:xpath, "//button[@class='btn btn-success btn-success-red']").click
$driver.alert.ok()
$log.info("create organization successful")
错误:
/Users/usr/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/safari/bridge.rb:73:从
raw_execute': A modal dialog was opened. The SafariDriver does not support interacting with modal dialogs. To avoid hanging your test, the alert has been dismissed. For more information, see http://code.google.com/p/selenium/issues/detail?id=3862 (Selenium::WebDriver::Error::UnhandledAlertError) from /Users/usr/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:612:in
/Users/usr/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge 执行。 rb:369:inclickElement' from /Users/usr/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/common/element.rb:54:in
click' 来自 /Users/usr/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.10/lib/watir-webdriver/元素click' from /Users/usr/Documents/workspace/TTQA Safari/tttestlibrary.rb:47:in
/element.rb:132:in create_org' 来自 /Users/usr/Documents/workspace/TTQA Safari/ttorgusercompare.rb:23:inorg_user_compare' from /Users/usr/Documents/workspace/TTQA Safari/ttorgusercompare.rb:34:in
'
谢谢!