電子商取引アプリケーションの商品ページからの購入を自動化しようとしています。ユーザが[今すぐ購入]ボタンをクリックすると、ログインがポップアップ表示され、ユーザのクレデンシャルが入力されます。ユーザーが正常にログインすると、確認のオーバーレイが表示され(確認のためのログインウィンドウが閉じられます)、購入オプションが確認されます。ただし、Webdriverは親ブラウザウィンドウでセッションを認識できません。ここでWebDriver :: Error :: UnknownError:セッションにドライバがありません。ブラウザウィンドウが閉じている可能性があります - 確認オーバーレイを認識できません
は、私がテストを駆動するために使用していますスクリプトです:これは私がそれを見たのは初めてであるよう
require "rubygems"
require "watir-webdriver"
browser = Watir::Browser.start "http://qa02.barnesandnoble.com/w/james-pattersons-witch- and-wizard-james-patterson/1101936910?ean=2940000962145&itm=1&usri=james+patterson"
browser.button(:caption,'Buy Now').click
sleep 5 #Wait until the Log in Pop comes up
puts browser.windows.size
browser.window(:url,/signin/).use
browser.text_field(:id, "login-email").set "[email protected]"
browser.text_field(:id, "login-password").set "bookcom"
browser.button(:caption,/Secure Sign In/).click
sleep 8 #Wait until confirm overlay appears
puts browser.windows.size
browser.window(:url,/w/).use
browser.button(:caption,/Confirm/).click
?> browser.button(:caption,/Confirm/).click
Selenium::WebDriver::Error::UnknownError: Session [a758cfba-7f00-f148-b9e6-f969c9402228] has no driver. The browser window may have been closed.
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/command_processor.js:10583:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/driver_component.js:9631:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/driver_component.js:9785:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/driver_component.js:9732:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/driver_component.js:10781:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/httpd.js:1935:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/httpd.js:2261:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/httpd.js:1168:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/httpd.js:1616:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/httpd.js:1464:in `unknown'
from [remote server] file:///var/folders/wM/wMhMTIyBE9Cdrfjt6sgbPk+++TQ/-Tmp-/webdriver-profile20120311-1255-16gc4a5/extensions/[email protected]/components/httpd.js:1333:in `unknown'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/http/default.rb:64:in `request'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/bridge.rb:594:in `raw_execute'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/bridge.rb:572:in `execute'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/bridge.rb:183:in `switchToDefaultContent'
from /Library/Ruby/Gems/1.8/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/common/target_locator.rb:68:in `default_content'
from /Library/Ruby/Gems/1.8/gems/watir-webdriver-0.5.3/lib/watir-webdriver/browser.rb:166:in `assert_exists'
from /Library/Ruby/Gems/1.8/gems/watir-webdriver-0.5.3/lib/watir-webdriver/elements/button.rb:52:in `locate'
from /Library/Ruby/Gems/1.8/gems/watir-webdriver-0.5.3/lib/watir-webdriver/elements/element.rb:361:in `assert_exists'
from /Library/Ruby/Gems/1.8/gems/watir-webdriver-0.5.3/lib/watir-webdriver/elements/element.rb:94:in `click'
from secondruby.rb:15>>
エラーメッセージには、ブラウザ(ウィンドウ)が(おそらく)閉じていると表示されます。「ブラウザウィンドウが閉じられている可能性があります。 –