Seita developer blog

ユーザ企業に努めるアプリケーションエンジニアがプログラミング、データベース、OS、SNS、ガジェットなどを中心に備忘録変わりに書いていきます。

【Selenium】IE11にてSeleniumが正常に動作しないときの対処法

Internet Explorer 11にて、WebDriverを用いたSeleniumテストが正常に動作しないときの対処法です。

対象OSは「Windows 7」及び「Windows 10」です。

 

■イベントの動作が異常に遅い

WebDriverのバージョンをx86(32bit)版を利用するようにしてください。

※OSがx64でもx86を使わないと正常にイベントが動かないときがあります。

 

■画面のクリックイベントが動かない

画面の倍率を100%に戻して実行してください。

f:id:rey1229:20170905133049p:plain


■SessionNotFoundException(Unexpected error launching Internet Explorer. Browser zoom)例外が発生する。

例外詳細
org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Browser zoom level was set to 75%. It should be set to 100% (WARNING: The server did not provide any stacktrace information)

 Internet Explorerの拡大の倍率を100%にしてください。

f:id:rey1229:20170905133343p:plain



■SessionNotFoundException(Unexpected error launching Internet Explorer. Protected Mode)

例外詳細

org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information) 

IEのセキュリティタブの保護モードの設定を統一してください

※推奨はすべてにチェックをつけます。

f:id:rey1229:20170905133750p:plain



■NoSuchWindowException(Unable to find element on closed window)

例外詳細

org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window (WARNING: The server did not provide any stacktrace information) 

 

IEの設定のセキュリティタブのイントラネットを手動検出に設定するように設定してください。

 

設定方法1)

Selenium初回実行時にIEの下部に現れる「イントラネットの設定を有効にする」ボタンを押下してください。

f:id:rey1229:20170905134032p:plain

 

設定方法2)

インターネットオプション→セキュリティタブ→ローカルイントラネット→サイトをクリックし以下の通り設定してください。

f:id:rey1229:20170905134159p:plain