Reputation: 1414
It's convenient to set WebDriver's implicitWait time when webapp contains lots of dynamically loaded contents. But the global implicitWait time turns out to be too long sometimes, in which cases I wish to reduce it temporarily, and then restore it to its previous value.
The problem is : How to retrieve the value of the webdriver's current implicitWait time?
Upvotes: 1
Views: 101
Reputation: 1320
You can wrapp to a method something like
Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(expected time to wait for element here))
Introduce a FINAL value (eg. 45sec). Change ImplicitlyWait by the method - before FindElement is called - to any value and then go back to your FINAL one.
Note:After creation of driver default ImplicitlyWait is equal to 0sec at the very beginning.
But if I were you I would overload common FindElement/FindElements method and add there Explicitly wait. It would work like following:
1)Driver.FindElement(By something) <-- uses global ImplicitlyWait
2)Driver.FindElement(By something, 10) <-- uses Explicitly
It's much more flexible solution.
Upvotes: 2