TestStack / TestStack.Seleno

Seleno helps you write automated UI tests in the right way by implementing Page Objects and Page Components and by reading from and writing to web pages using strongly typed view models.
http://teststack.github.com/TestStack.Seleno/
MIT License
180 stars 60 forks source link

WebDriverException : The HTTP request to the remote WebDriver server for URL timed out after 60 seconds #205

Open sirj77 opened 9 years ago

sirj77 commented 9 years ago

Hi guys,

I'm experiencing with a problem while running automated test-cases, the stack trace: WebDriverException : The HTTP request to the remote WebDriver server for URL timed out after 60 seconds

So, after click the button I'm waiting for the results that should be shown on the page, but, I guess, it takes too long time for getting them, and the system throws an exception.

A piece of code:

  public void Check()
        {
            Find.Element(By.CssSelector(CssSelector)).Click();
        }

 public SomePage  NumberCheckt(string serialNumber)
        {
            SerialNumberSericeNet = serialNumber;
            Check();
            WaitResults();
            return this;
        }

        public SomePage  WaitResults()
        {
            var wait = new WebDriverWait(Browser, TimeSpan.FromSeconds(90));
            wait.Until(d =>
            {
                if (!ProductImage)
                    return false;

                return ProductImage;
            });
            return this;
        }

I'm getting an exception on the Check() method. Even though I have WaitResults() method with wait 90 seconds, an exception pops up just after 60 seconds, what's wrong?

robdmoore commented 9 years ago

This is likely that you have too recent a version of Firefox (or whatever browser you are using) but not new enough version of selenium web driver.

On 25 Jun 2015, at 8:24 pm, sirj77 notifications@github.com wrote:

Hi guys,

I'm experiencing with a problem while running automated test-cases, the stack trace: WebDriverException : The HTTP request to the remote WebDriver server for URL timed out after 60 seconds

So, after click the button I'm waiting for the results that should be shown on the page, but, I guess, it takes too long time for getting them, and the system throws an exception.

A piece of code:

public void Check() { Find.Element(By.CssSelector(CssSelector)).Click(); }

public SomePage NumberCheckt(string serialNumber) { SerialNumberSericeNet = serialNumber; Check(); WaitResults(); return this; }

    public SomePage  WaitResults()
    {
        var wait = new WebDriverWait(Browser, TimeSpan.FromSeconds(90));
        wait.Until(d =>
        {
            if (!ProductImage)
                return false;

            return ProductImage;
        });
        return this;
    }

I'm getting an exception on the Check() method. Even though I have WaitResults() method with wait 90 seconds, an exception pops up just after 60 seconds, what's wrong?

— Reply to this email directly or view it on GitHub.

sirj77 commented 9 years ago

Well, I'm using Google Chrome v. 41.0 and Selenium web Driver 2.46.0.0 As I know it is a new one of Selenium.

robdmoore commented 9 years ago

Hmm, what version of ChromeDriver are you using?

IS you switch to Firefox do you get the same error or is it restricted to Chrome only?

sirj77 commented 9 years ago

I'm using at least version 2.14 or 2.15 of ChromeDriver. I didn't try to reproduce this exception using Firefox for now

sirj77 commented 9 years ago

Hi! I've tried to test on FireFox (latest version), it's likely that I have less exceptions, but sometimes I get "WebDriverException : The HTTP request to the remote WebDriver server for URL timed out after 60 seconds", for example, on some specific page: I'm observing that the page is not loaded fully and it's showing a dynamic spinner while waiting for some services is loaded (in my case it's "waiting www.facebook...")

sirj77 commented 8 years ago

Hay,

From time to time I'm experiencing the same problem - "WebDriverException : The HTTP request to the remote WebDriver server for URL timed out after 60 seconds" So, if I do some action on the page and should wait some time (more than 60 sec; unfortunately, yes, we have some places on the web site where a complete loading takes more than 1 min) before I start to interact with another element, the test would be failed because of the time out. How to handle such situation? I'm using Selenium 2.46.0.0 and FireFox 42.0.

robdmoore commented 8 years ago

There are two causes to this exception I've seen:

  1. Browser/web driver version mismatch - solved by updating webdriver nuget package to latest usually
  2. Server-side takes too long to load page - solved by either getting a faster server or as per https://code.google.com/p/selenium/issues/detail?id=5071 it looks like you can add a timeout argument when newing up a RemoteWebDriver, in Seleno that happens in Browser, but you don't have to use Browser you can new up the driver yourself to try out the fix. Feel free to submit a PR to Seleno to allow that timespan to be passed in as an option to the various drivers (probably in the override that has capabilities passed in)