2017-03-08 4 views
1

セレンで遊んでいて、Internet Explorer 11を実行しようとしましたが、以下のエラーが表示されます。セレンにIEDriverを使用するには?

Started InternetExplorerDriver server (32-bit) 
3.1.0.0 
Listening on port 25172 
Only local connections are allowed 
java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl. java:43) 
at java.lang.reflect.Method.invoke(Method.java:498) 
at                  com.pccw.bpss.qa.automation.Application.execute_Actions(Application.java:79) 
at com.pccw.bpss.qa.automation.Application.executeTestCase(Application.java:71) 
at com.pccw.bpss.qa.automation.Application.main(Application.java:51) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:498) 
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to 
create new remote session. desired capabilities = Capabilities  
[{ie.ensureCleanSession=true}], required capabilities = Capabilities [{}] 
Build info: version: '3.1.0', revision: 'b94c902', time: '2017-02-16  
12:21:31 -0800' 
System info: host: 'PC81013161', ip: '10.37.210.32', os.name: 'Windows 
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_92' 
Driver info: driver.version: InternetExplorerDriver at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91) 
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141) 
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82) 
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) 
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241) 
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227) 
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:182) 
at org.openqa.selenium.ie.InternetExplorerDriver.<init> (InternetExplorerDriver.java:174) 
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:150) 
at com.pccw.bpss.qa.automation.execution.ActionKeywords.openBrowser(ActionKeywords.java:45) 
... 12 more 

Firefoxを実行しようとしましたが正常に動作しました。私はまた、IEのセキュリティ機能を変更しようとしましたが、それでも私は同じエラーが発生します。

以下は、エラーが発生したコードスニペットです。エラーは、次の場合に役立ちます参照してください

System.setProperty(KEY_IE_DRIVE, FILE_PATH_DRIVER_IE_X32_EXE); 
DesiredCapabilities cap = new DesiredCapabilities(); 
cap.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true); 
driver = new InternetExplorerDriver(cap); 
driver.manage().window().maximize(); 
+0

32ビットJREで実行できますか? –

+1

http://stackoverflow.com/a/40421616/1119381 –

+0

@ElliottFrischこれまでIEを使用していて、同じ環境で使用しています。デフォルトで私はFirefoxのブラウザを使用しているし、私はIEに切り替え、これが発生します。 – prix

答えて

3

)InternetExplorerDriver(の初期化時に発生します。

  1. ゴーインターネットオプションへ
  2. セキュリティ
  3. クリック上:「すべてのゾーンを既定のレベルにリセット「
  4. ティックは、 『すべてのゾーンで保護モード』のチェックボックスをオンに
+1

ありがとう!すべてのゾーンで「保護モードを有効にする」をチェックし、セキュリティバーを中〜低に調整しました。今はうまくいく! :) – prix

関連する問題