3
私のCドライブにローカルのhtmlファイル があり、それを開いてボタンをクリックしようとしています。 HTMLファイルは次のようになります。ワイアでローカルHTMLを開く際の問題
<html>
<body>
<div id="first">
<div id="second">
<div id="third">
<button id="button">Text</button>
</div>
</div>
</div>
<p id="txt">Not clicked yet</p>
<script type="javascript">
var par = document.getElementById('txt');
function clicked() {
if (par.innerText == 'Clicked') {
par.innerHTML = 'Clicked Again';
} else {
par.innerHTML = 'Clicked';
}
}
</script>
</body>
は、私は、ファイルを開くボタンをクリックし、次のコードを使用しようとしています:
require 'watir-webdriver'
browser = Watir::Browser.new :ie
browser.goto "file://C:\\test.html"
browser.button(id: 'button').click
が、私は次の例外を取得しています:
Watir::Exception::NoMatchingWindowFoundException: browser window was closed
他の非ローカルURLにアクセスするとすべて正常に動作します。 誰もこの問題を解決する方法を知っていますか?
私のシステムのparams:Windowsの場合
Windows 7 64 bit, IEDrvierServer 2.49, IE11
'file://'をURLの前に付ける必要がありますか? 'watir-classic'(IEを使うときは' watir')に必要だったものを漠然と思い出して、 'watir-webdriver'を使っています。 – orde
はい、それ以外の場合は、http:\\ wwwをURLの前に付加します –