Web アプリケーションのいくつかのテストを自動化しようとしていますが、多くのテストでは、<iframe>
. 同じ内の 1 つの jspContainer から別の jspContainer にアンカーをドラッグしてい<iframe>
ます。Selenium::WebDriver::Error::MoveTargetOutOfBoundsError:
ドラッグアンドドロップを実行しようとすると、取得し続けます。hover
メソッドを使用しようとすると、同じエラーが発生します。しかし、click
メソッドを使用してアンカーをクリックすると、正しく機能し、リンクがクリックされたかのように強調表示されます。以下は、irb を介した私のコードと出力の一部です。
irb(main):048:0> a = b.frame(:id => "Iframe").link(:text => "anchor")
=> #<Watir::Anchor:0x..f02685d6 located=false selector={:text=>"anchor", :tag_name=>"a"}>
irb(main):049:0> c = b.frame(:id => "Iframe").div(:id => "drop")
=> #<Watir::Div:0x5ed628c6 located=false selector={:id=>"drop", :tag_name=>"div"}>
irb(main):050:0> a.wd.location
=> #<struct Selenium::WebDriver::Point x=295, y=339>
irb(main):051:0> c.wd.location
=> #<struct Selenium::WebDriver::Point x=30, y=329>
irb(main):052:0> c.style
=> "width: 250px; height: 100px;"
irb(main):053:0> b.frame(:id => "Iframe").locate
=> #<Watir::FramedDriver:0x24f3738 @element=#<Selenium::WebDriver::Element:0x..fc6af7d56 id="{11f61368-a4ea-4d
a9-9084-6307abcda2aa}">, @driver=#<Selenium::WebDriver::Driver:0x..f97d59986 browser=:firefox>>
irb(main):054:0> a.drag_and_drop_on c
Selenium::WebDriver::Error::MoveTargetOutOfBoundsError: Given coordinates (432, 542) are outside the document.
Error: MoveTargetOutOfBoundsError: The target location (432, 544) is not on the webpage.
irb(main):056:0* a.hover
Selenium::WebDriver::Error::MoveTargetOutOfBoundsError: Given coordinates (432, 542) are outside the document.
Error: MoveTargetOutOfBoundsError: The target location (432, 544) is not on the webpage.
irb(main):059:0* a.click
=> []
私が気づいたことの 1 つは、変数a
を設定すると、irb からの出力が .c と表示されることlocated=false
です。しかし、exists?
、click
、およびflash
メソッドを使用して、watir-webdriver がこれらの要素の場所を認識していることを示すことができます。ヘルプや提案をいただければ幸いです。
私はwatir-webdriver 0.6.2、Firefox 18.0.2、Windows 7 64ビットを使用しています