Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

C# WebDriverWait will not wait longer than 60 seconds. #4874

Closed
lukeis opened this issue Mar 4, 2016 · 3 comments
Closed

C# WebDriverWait will not wait longer than 60 seconds. #4874

lukeis opened this issue Mar 4, 2016 · 3 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 4874

Description
--
I have ran into a situation where I need to wait for an expected condition for more
than 3 minutes (at times up to 1.5 hours). When using WebDriverWait, no matter what
I set the timeout to, it throws an exception after 60 seconds every time.

What steps will reproduce the problem?
--
1. Create WebDriverWait object with a time greater than 60 seconds.
2. Perform the wait on an ExpectedCondition.ElementExists(By)
3. Execute test

What is the expected output? What do you see instead?
--
It should throw the exception after 2 minutes. Instead it is throwing the exception
after 60 seconds.

Selenium version: 2.26.0
OS: Windows 7 Enterprise
Browser: Firefox
Browser version: 17

I also tried setting the implicit wait to 2 minutes and just using a driver.FindElement
and it also threw an exception after 60 seconds. Below is a sample demonstrating this
behavior.


IWebDriver driver = new FirefoxDriver();

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromMinutes(2));

Console.Out.WriteLine("Start: " + DateTime.Now);
try {
    IWebElement e = wait.Until<IWebElement>(ExpectedConditions.ElementExists(By.Id("null")));
} catch(Exception ex) {
    Console.Out.WriteLine(ex.Message);
}

Console.Out.WriteLine("End: " + DateTime.Now);

driver.Quit();

Reported by Daniel.Dale.Armstrong on 2012-12-05 17:09:00

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Each driver class has a constructor overload that allows you to set the timeout for
each command. Here is an example for the FirefoxDriver to set the command timeout to
5 minutes:

IWebDriver driver = new FirefoxDriver(new FirefoxBinary(), null, TimeSpan.FromMinutes(5));

You can find similar constructor overloads for InternetExplorerDriver, ChromeDriver,
and RemoteWebDriver.

Reported by james.h.evans.jr on 2012-12-05 17:20:45

  • Status changed: WorkingAsIntended

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

When using these constructors it appears that the WebDriverWait is overridden.

IWebDriver driver = new FirefoxDriver(new FirefoxBinary(), null, TimeSpan.FromHours(2));

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromMinutes(2));
...

This caused it to wait for 2 hours rather than two minutes. Is this the expected behavior?

Reported by Daniel.Dale.Armstrong on 2012-12-05 18:50:19

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:16:26

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant