Selen Fehler: Keine Antwort vom server für die url http://localhost:7055

Ich bin mit Selen, C#, NUnit, Test schreiben, manchmal bekomme ich folgende Fehlermeldung:-

OpenQA.Selen.WebDriverException : Keine Antwort vom server für die url
http://localhost:7055/hub/session/8dd13f5c-7ca6-4aa6-babc-f0ff6d940f0a/element

Hier ist stack trace:

OpenQA.Selen.WebDriverException : Keine Antwort vom server für die url
http://localhost:7055/hub/session/8dd13f5c-7ca6-4aa6-babc-f0ff6d940f0a/element
bei
OpenQA.Selen.Remote.HttpCommandExecutor.CreateResponse(WebRequest
Anfrage)
c:\Projekte\WebDriver\trunk\dotnet\src\WebDriver\Remote\HttpCommandExecutor.cs:Zeile
115 auf OpenQA.Selen.Remote.HttpCommandExecutor.Execute(Befehl
commandToExecute)
c:\Projekte\WebDriver\trunk\dotnet\src\WebDriver\Remote\HttpCommandExecutor.cs:Zeile
96
OpenQA.Selen.Firefox.Intern.ExtensionConnection.Execute(Befehl
commandToExecute)
c:\Projekte\WebDriver\trunk\dotnet\src\WebDriver\Firefox\Internal\ExtensionConnection.cs:Zeile
128 bei OpenQA.Selen.Remote.RemoteWebDriver.Execute(String
driverCommandToExecute, Dictionary`2 parameters) bei
c:\Projekte\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:Zeile
795 bei OpenQA.Selen.Remote.RemoteWebDriver.FindElement(String
Mechanismus, String-Wert) in
c:\Projekte\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:Zeile
836 bei OpenQA.Selen.Remote.RemoteWebDriver.FindElementById(String
id) in
c:\Projekte\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:Zeile
431 bei OpenQA.Selen.Durch.<>c__DisplayClass2.b__0(ISearchContext
Kontext) in
c:\Projekte\WebDriver\trunk\dotnet\src\WebDriver\.cs:Zeile 102 auf
OpenQA.Selen.Durch.FindElement(ISearchContext Kontext) in
c:\Projekte\WebDriver\trunk\dotnet\src\WebDriver\.cs:Zeile 272 an
OpenQA.Selen.Remote.RemoteWebDriver.FindElement(By durch)
c:\Projekte\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:Zeile
289 bei

.####.##.#####.#########.#####.ShareServicesTest.CreateShareWidget()

Code, wo dieser Fehler angezeigt wird:

Driver.SwitchTo().Frame(frameElement);    
var wait = new WebDriverWait(parentContextable.Context.Driver, Timeout);
IWebElement element = wait.Until(d => Driver.FindElement(By.TagName(Tags.Body))); //error in this line

Ich herausgefunden, dass dieser Fehler ausgelöst werden kann nur auf diese Zeilen von Selen Umsetzung-code:

private static Response CreateResponse(WebRequest request)
        {
            Response commandResponse = new Response();

            HttpWebResponse webResponse = null;
            try
            {
                webResponse = (HttpWebResponse)request.GetResponse();
            }
            catch (WebException ex)
            {
                webResponse = (HttpWebResponse)ex.Response;
            }

            if (webResponse == null)
            {
                throw new WebDriverException("No response from server for url " + request.RequestUri.AbsoluteUri);
            }
            else
            { ...

Weiss vielleicht jemand, warum die Anfrage.GetResponse() gibt null zurück, oder wenn es scheitert, warum ex.Antwort auch null?

(09.09.2012) Sorry, aber ich vielleicht nicht alle Informationen. Ich bin mit FireFox-Treiber, Win7, Selen 2.25.1. Mein test schlägt fehl, nur manchmal. Test im debug-Modus fehlschlägt, weniger oft, dann Release.

Hier Fand ich mögliche Gründe, warum dies geschehen ist. Und wenn ich Schreibe code:

Driver.SwitchTo().Frame(frameElement);    
var wait = new WebDriverWait(parentContextable.Context.Driver, Timeout);
Tread.Sleep(250);
IWebElement element = wait.Until(d => Driver.FindElement(By.TagName(Tags.Body)));

Test läuft OK. Aber Thread.Schlaf ist schlechte Lösung. Vielleicht jemanden finden könnte, eine andere, wenig bessere Lösung.

InformationsquelleAutor der Frage Frigik | 2012-09-07

Schreibe einen Kommentar