一些奇怪的是發生在本頁面:硒:: webdriver的::錯誤:: MoveTargetOutOfBoundsError:元素不能被滾動到視圖:對象HTMLSpanElement]
require "watir-webdriver"
b = Watir::Browser.new
b.goto "http://mideastunes.com/"
b.div(class: "feat-container").element(css: "a span").present?
=> true
b.div(class: "feat-container").element(css: "a span").click
Selenium::WebDriver::Error::MoveTargetOutOfBoundsError: Element cannot be scrolled into view:[object HTMLSpanElement]
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/http/default.rb:64:in `request'
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/bridge.rb:590:in `raw_execute'
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/bridge.rb:568:in `execute'
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/remote/bridge.rb:350:in `clickElement'
from /Users/zeljko/.rvm/gems/[email protected]/gems/selenium-webdriver-2.19.0/lib/selenium/webdriver/common/element.rb:34:in `click'
from /Users/zeljko/.rvm/gems/[email protected]/gems/watir-webdriver-0.5.3/lib/watir-webdriver/elements/element.rb:107:in `click'
from (irb):48
from /Users/zeljko/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'
我試圖單擊此跨度:
<span class="feature-prev-icon icon"></span>
我可以用這個點擊:
b.span(class: "feature-prev-icon icon").click
,但我想這個點擊:
b.div(class: "feat-container").element(css: "a span").click
環境:Mac OS X的10.7.3,火狐10.0.1,紅寶石1.9.2p290,硒webdriver的2.19.0,的Watir-的webdriver 0.5.3
我剛剛得到了同樣的結果在FF10在Windows Vista上家庭高級版。這是一個我非常虛弱的領域,但我會嘗試進一步瞭解它。 – 2012-02-14 04:46:02
問題在Gentoo Linux,Firefox 10.0,ruby 1.9.2p290,selenium-webdriver 2.19.0,watir-webdriver 0.5.3 中是可重現的但是,只要普通的硒相同的錯誤發生,它不是watir-webdriver問題。 webdriver的 'b.find_element。(:CSS => 「div.feat容器」)find_element。(:CSS => 「跨度」)click' – p0deje 2012-02-14 12:56:22
礦山運行,但它點擊播放按鈕,而不是地方。 watir-webdriver 0.3.9,Windows 7中的selenium-webdriver 2.12.1,Firefox 8.所以我有點落後。 – anonygoose 2012-02-14 14:06:19