Watir-Webdriverを使用して、フォーカスをiframeに変更し、その中にあるリンクを取得したいと思います。
これがhtmlコードです
<iframe id="top_right" src="otherwebsite.com/need content src">
<a href="need this"> <img src="need this" /> </a>
だから私が欲しいのはiframe
、に行き、そのsrcを取得し、要素からhref
とをキャプチャし、最後にこれらの要素をクリックしてデータを取得することです。src
img
これは、Rubyを使用した私の試みです。
require 'watir-webdriver'
b = Watir::Browser.new
b.goto 'somesite.com'
b.wait
f = b.frame(:id => 'top_right').link(:index => 1).click
私はここまで来ましたが、残念ながら私はまだ次の応答を受け取ります:
in `assert_exists': unable to locate element, using {:index=>1, :tag_name=>"a"} (Watir::Exception::UnknownObjectException)
ですから、誰か助けがあれば、それは素晴らしいtnxでしょう。