2016-09-09 56 views
0

IE 11のウィンドウ7でSelenium WEbdriverを実行する際に問題が発生しています。送信キーが非常に遅いです。 IE用の最新のwebdriverをダウンロードしましたが、まだ動作しません。IE 11でSelenium Webdriverがタイムアウトしました

Test Name: TestInInternetExplorer 
Test FullName: TravelTest_1.UnitTest1.TestInInternetExplorer 
Test Source: c:\Users\Documents\Visual Studio 2013\Projects\TravelTest_1\TravelTest_1\UnitTest1.cs : line 34 
Test Outcome: Failed 
Test Duration: 0:01:36.7213961 

Result Message: 
Test method TravelTest_1.UnitTest1.TestInInternetExplorer threw exception: 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:14927/session/41c432de-a158-4a14-bbc0-38a21cd67582/element/c9da6f89-09e9-4da9-a84a-ea262762491d/value timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out 
Result StackTrace: 
at System.Net.HttpWebRequest.GetResponse() 
    at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) 
--- End of inner exception stack trace --- 
    at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) 
    at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) 
    at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute) 
    at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) 
    at OpenQA.Selenium.Remote.RemoteWebElement.SendKeys(String text) 
--- End of inner exception stack trace --- 
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) 
    at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) 
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
    at OpenQA.Selenium.Support.PageObjects.WebDriverObjectProxy.InvokeMethod(IMethodCallMessage msg, Object representedValue) 
    at OpenQA.Selenium.Support.PageObjects.WebElementProxy.Invoke(IMessage msg) 
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
    at OpenQA.Selenium.IWebElement.SendKeys(String text) 
    at TravelTest_1.CreateTANonProxy_Domestic.FillGeneralInfo() in c:\Users\Documents\Visual Studio 2013\Projects\TravelTest_1\TravelTest_1\CreateTANonProxy_Domestic.cs:line 112 
    at TravelTest_1.UnitTest1.CreateTADraft(IWebDriver driver) in c:\Users\Documents\Visual Studio 2013\Projects\TravelTest_1\TravelTest_1\UnitTest1.cs:line 123 
    at TravelTest_1.UnitTest1.TestInInternetExplorer() in c:\Users\Documents\Visual Studio 2013\Projects\TravelTest_1\TravelTest_1\UnitTest1.cs:line 44 

私のコードは以下の通りです::以下

InternetExplorerOptions options = new InternetExplorerOptions(); 
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true; 

    using (IWebDriver IEDriver = new InternetExplorerDriver(options)) 
    { 

     Console.WriteLine("Executed in IE 11"); 
     CreateTADraft(IEDriver); 
     Console.WriteLine("Draft saved in IE 11"); 
    } 

そして、問題のあるコードされています

count = counter; 
    if (count.Equals(counter)) 
    { 
     count = count + 1; 
     y = count; 
    } 
    try 
    { 
     using (var context = new MainDataContext(Properties.Settings.Default.ConnectionString)) 
     { 
      foreach (var e in context.TARequestForm.Where(x => x.Id == y)) 
      { 
       String contact = e.Phone; 
       String purpose = e.Purpose; 
       purposeBox.Clear(); 
       purposeBox.SendKeys(purpose); 
       contactBox.Clear(); 
       contactBox.SendKeys(contact); 
      } 
     } 
    }catch(WebDriverTimeoutException e) 
    { 
     Console.WriteLine(e); 
     throw e; 
    } 

私はわからないが、以下に、私が受けたままタイムアウトの例外があります私ができるすべての回避策のもうBtw、これは実際にIEで動作し、キーを送信する途中で停止します。ありがとう。

InternetExplorerOptions options = new InternetExplorerOptions(); 
    options.IntroduceInstabilityByIgnoringProtectedModeSettings = true; 
    options.RequireWindowFocus = true; 

これは私のSendKeysをスピードアップ:

+0

System.Net.HttpWebRequest.GetResponse()でタイムアウトは、送信キーとは何の関係もないことを示しています。サーバが60秒以内に応答しなかった可能性があります – Steve

+0

@Steveとはどういう意味ですか?私はすでに暗黙のうちにこの問題を解決すると思ったので私は暗黙のうちに待っています。 – Marj

+0

あなたのWebサーバの問題を意味します。または、接続が正しく設定されていません。または、Webサーバーがlocalhostに対して正しく設定されていない可能性があります。コード/サーバーログがなければ、何も言えません。 – Steve

答えて

0

コードに次のように追加しました。 RequireWindowFocusが私の問題を解決しました。ありがとう@Kolichikov