Tengo una página con algo como esto:modal presentes de diálogo (Selenio :: WebDriver :: Error :: UnhandledAlertError) después de despedir confirmar emergente
<input type="button" onclick="confirm('confirm popup');" value="click" />
Cuando voy a la página y haga clic en el enlace:
require "watir-webdriver"
browser = Watir::Browser.new
browser.goto "page.html"
browser.button.click
aparece la ventana emergente de confirmación. Puedo descartarlo con esto:
require "watir-webdriver/extensions/alerts"
browser.confirm(true) {browser.button(:value => 'Confirm').click}
pero el me sale este mensaje de error:
[remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/command_processor.js:10302:in `unknown': Modal dialog present (Selenium::WebDriver::Error::UnhandledAlertError)
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/driver-component.js -> file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/dispatcher.js:85:in `unknown'
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/driver-component.js -> file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/dispatcher.js:516:in `unknown'
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/driver-component.js -> file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/dispatcher.js:351:in `unknown'
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/driver-component.js -> file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/webdriverserver.js:47:in `unknown'
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/httpd.js:1935:in `unknown'
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/httpd.js:2261:in `unknown'
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/httpd.js:1168:in `unknown'
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/httpd.js:1616:in `unknown'
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/httpd.js:1464:in `unknown'
from [remote server] file:///var/folders/yx/bz_81fc143b4r9pyhks300m00000gn/T/webdriver-profile20120218-1562-7b7q8d/extensions/[email protected]/components/httpd.js:1333:in `unknown'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/http/default.rb:64:in `request'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/bridge.rb:590:in `raw_execute'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/bridge.rb:568:in `execute'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/bridge.rb:314:in `executeScript'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/common/driver.rb:209:in `execute_script'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/watir-webdriver-0.5.3/lib/watir-webdriver/browser.rb:129:in `execute_script'
from /Users/zeljko/.rvm/gems/ruby-1.9.3-p125/gems/watir-webdriver-0.5.3/lib/watir-webdriver/extensions/alerts.rb:39:in `confirm'
from popup.rb:7:in `<main>'
¿Qué estoy haciendo mal?
Medio Ambiente:
- Mac OS X 10.7.3
- Firefox 10.0.2
- Rubí 1.9.3p125
- selenio WebDriver 2.19.0
- Watir-WebDriver 0.5.3
Gracias Chuck. Hay una cerveza esperándote en Austin. :) Lo curioso es que no veo aparecer la ventana emergente cuando uso 'browser.confirm (true) {browser.button.click}'. Supongo que anula la función de JavaScript 'window.confirm', similar a' browser.execute_script ("ventana.confirm = function() {return true} ")' –
Podría ser, sin embargo, su código estaba ejecutando el clic que debería haberlo hecho aparecer, por lo que no estoy seguro de lo que hay allí. Te llevaré a la cerveza. Compraré usted a cambio si encuentra el tiempo para obtener la información anterior y en la otra respuesta vinculada en la wiki watir o en algún lugar que sea más fácil para nuestros usuarios encontrar. –
El plan es ponerlo todo en el libro, pero yo solo no tenía el tiempo hasta ahora. Debe estar en el libro antes de Bazar. –