Selenium error: No response from server for url http://localhost:7055

21,398

Solution 1

Found Following workarounds here:

https://groups.google.com/forum/?fromgroups=#!topic/selenium-users/1im-LurjK5s

http://watirmelon.com/2011/10/04/c-avoiding-the-webdriverexception-no-response-from-server-for-url/

Solution 2

Are you using IE? I was getting this until I discovered that I could set the base URL through config on the object. Otherwise, the first page it takes you to is something generated by Selenium, and it seems to miss the cues for the "real" request.

 var options = new InternetExplorerOptions()
 {
     InitialBrowserUrl = _baseUrl,
     IntroduceInstabilityByIgnoringProtectedModeSettings = true
 };

 _driver = new InternetExplorerDriver(_ieDriverServerPath, options);

I use that in a TextFixtureSetup method in my tests.

Share:
21,398
Frigik
Author by

Frigik

Updated on February 01, 2020

Comments

  • Frigik
    Frigik over 4 years

    I'm using Selenium, C#, NUnit to write tests, sometimes I getting below error:-

    OpenQA.Selenium.WebDriverException : No response from server for url httр://lоcalhost:7055/hub/session/8dd13f5c-7ca6-4aa6-babc-f0ff6d940f0a/element

    Here is stack trace:

    OpenQA.Selenium.WebDriverException : No response from server for url httр://localhost:7055/hub/session/8dd13f5c-7ca6-4aa6-babc-f0ff6d940f0a/element at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\HttpCommandExecutor.cs:line 115 at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\HttpCommandExecutor.cs:line 96 at OpenQA.Selenium.Firefox.Internal.ExtensionConnection.Execute(Command commandToExecute) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Firefox\Internal\ExtensionConnection.cs:line 128 at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 795 at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 836 at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementById(String id) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 431 at OpenQA.Selenium.By.<>c__DisplayClass2.b__0(ISearchContext context) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\By.cs:line 102 at OpenQA.Selenium.By.FindElement(ISearchContext context) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\By.cs:line 272 at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 289 at

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

    Code where this error appears:

    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
    

    I figured out that this error can be thrown only in this lines of Selenium implementation 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
                { ...
    

    Maybe someone knows why request.GetResponse() returns null, or if it fails why ex.Response also null?

    (09.09.2012) Sorry but maybe I didn't provide all information. I'm using FireFox driver, Win7, Selenium 2.25.1. My test fails only sometimes. Test in debug mode fails less often then in Release.

    Here I found possible reasons why this happen. And if I write such 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 runs OK. But Thread.Sleep is bad solution. Maybe somebody could find another, little bit better solution.

  • JimEvans
    JimEvans almost 12 years
    The InitialBrowserUrl property has nothing to do with the IE driver "missing" anything. It is simply a slight helper to assist a user in the case where they are unable to set the Protected Mode settings of the browser because their machine has been incorrectly locked down by an overzealous system administrator. If you are able to set the Protected Mode properties of IE in your environment, you should do so. This blog post gives the historical reasons why this hack was required.
  • MisterJames
    MisterJames almost 12 years
    Thanks for the insight, Jim, always great to get some backstory (especially from an insider). But the protected mode settings don't come into play for me and aren't reflected in the OP text (or error). It doesn't change the fact that when if you try to execute a request without setting this option that you may run into the problem above (as I have/do). The initial request isn't ever seen by the test script, and you get the "no response" text.