私はWeb用のUbuntuでWatir-WebDriverとRuby1.9.2を使用して自動テストを作成しています。いくつかの要素を持つiframeがあります。アイテムをクリックして、何が起こるかを確認する必要があります。<iframe>
見た目は次のとおりです。
<iframe id="iframe" align="top" some_attribute="some_attribute">
<html>
<head>
<title> Some title </title>
</head>
<body>
<div>
<button id="id_button" type="button" class="some_class"/>
</div>
</body>
</html>
</iframe>
ボタンをクリックすると、メニューが作成されます。しかし、watir-webdriverでボタンをクリックしても、彼が押さなかったかのように何も起こりません。Watirは例外を出力しませんが、ボタンを押さないでください。
この問題は、InternetExplorerでのみ発生します。FirefoxとChromeの場合、問題はありません。私のコードは次のようになります:
browser = Watir :: Browser.new (: remote,: url => "http://some_ip:4444/wd/hub",: desired_capabilities =>: internet_explorer)
browser.goto ("http://some_http.com")
browser.iframe.button (: id, "id_button"). click
私が書いたら
browser.iframe.button(: id, "id_button").attribute_value("class")
戻ってき"some_class"
ました。これは、アイテムが認識されていることを示していますが、それでも何も起こりません。