2016-09-09 6 views
0

IE 11 윈도우 7에서 Selenium WEbdriver를 실행하는 데 문제가 있습니다. Send Keys가 너무 느립니다. IE 용 최신 웹 드라이버를 이미 다운로드했지만 아직 작동하지 않습니다.Selenium Webdriver가 IE 11에서 시간 초과되었습니다.

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

at System.Net.HttpWebRequest.GetResponse() timeout은 send 키와 아무런 관련이 없음을 나타냅니다. 서버가 60 년대에 응답하지 않았을 가능성이 있음 – Steve

+0

@Steve는 무엇을 의미합니까? 나는 그것이 내 문제를 분명히 해결할 것이라고 생각했기 때문에 이미 암시 적으로 기다렸습니다. – Marj

+0

그것은 웹 서버의 문제를 의미합니다. 또는 연결이 제대로 설정되지 않았습니다. 또는 웹 서버가 localhost를 제대로 설정하지 않았을 수 있습니다. 코드/서버 로그가 없으면 아무 것도 말할 수 없습니다. – Steve

답변

0

코드에 다음을 추가했습니다. RequireWindowFocus가 내 문제를 해결했습니다. 감사합니다 @ Kolichikov

관련 문제