selenium: WebDriverWait is immediately raising a BROWSER_TIMEOUT exception rather than waiting for the given amount of time

Meta -

OS:
Windows 10 Selenium Version:
3.5.0 Browser:
Firefox 55.0.1

Browser Version:

Expected Behavior -

Running Selenium 3.5.0 in a grid, I would expect a WebDriverWait to run for a given amount of time, then a Message: OpenQA.Selenium.WebDriverTimeoutException exception to be raised.

Actual Behavior -

The wait fails immediately with a Message: System.InvalidOperationException : Session [2647d75b-987e-4797-99d3-e49eb1c4227a] was terminated due to BROWSER_TIMEOUT exception.

Downgrading Selenium to 3.3.0 resolves this and the wait works correctly.

Steps to reproduce -

Hub config;

{
  "port": 4444,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {},
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "cleanUpCycle": 5000,
  "role": "hub",
  "debug": true
}

Test

using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;

namespace UnitTestProject1
{
    [TestFixture]
    public class UnitTest1
    {

        public UnitTest1()
        {
        }

        [Test]
        public void TestMethod1()
        {
            IWebDriver driver;
            
            FirefoxOptions options = new FirefoxOptions();
            options.BrowserExecutableLocation = @"C:\Program Files\Mozilla Firefox\firefox.exe";

            driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), options.ToCapabilities());
            driver.Navigate().GoToUrl("https://google.com");

            WebDriverWait waits = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
            IWebElement element = waits.Until(ExpectedConditions.ElementIsVisible(By.Id("THISELEMENTIDDOESNOTEXIST")));
        }
    }
}

Run the above code sample with Selenium 3.5.0, geckodriver 0.18 and Firefox.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (7 by maintainers)

Most upvoted comments

Status report: reproduced, found the root cause, looking for a solution.