1

Ever since updating to the Marionette driver. Firefox is no longer doing waits. Basically I want it to log in, wait for the page to load then check to see if its logged in by finding "log out" on the page. Here's my setup

// navigate to url "http://..."
// Find Log In button and .Click()

WebDriverWait wait = new WebDriverWait(driver, System.TimeSpan.FromSeconds(30));
wait.Until(driver1 => ((IJavaScriptExecutor)driver).ExecuteScript("return document.readyState").Equals("complete"));

// Assert if the page contains "Log out"

What's happening is after It Clicks Log In, it's not waiting for the page to load so it will throw an error because it can't find "Log out"

I stress that the code worked for the older Firefox driver (Not Marionette) and also Chrome's driver. Anyone else getting an issue with the new Firefox Driver not doing waits?

Sorry I should have been clearer, Firefox driver isn't doing ANY waits, so waiting on an element existing won't work either

Louis
  • 146,715
  • 28
  • 274
  • 320
Jonny Ngan
  • 137
  • 2
  • 6
  • 1
    So why are you not waiting for logout button instead of waiting for readyState?? – Saurabh Gaur Aug 09 '16 at 17:55
  • Please provide more of the code you are using, the HTML of the Log In and Log out buttons, and the error you are getting. – JeffC Aug 09 '16 at 18:54
  • I could provide more code but not at the moment. As I said though, the older Firefox driver and the chrome driver works and does the waits, so assuming marionette works the same then my code should be correct if it worked for the other drivers – Jonny Ngan Aug 10 '16 at 21:06
  • @JeffC - the error is that It isn't finding "Log out" so the Assert is failing BUT the only reason it's failing is because it's not waiting for the page to reload after clicking log in, it's trying to find "Log out" immediately while it's still on the Log In page – Jonny Ngan Aug 10 '16 at 21:23
  • Read this? Might be same weird issue.. http://stackoverflow.com/questions/27114626/webdriver-waits-not-working-in-firefox – Pseudo Sudo Aug 17 '16 at 12:46

1 Answers1

0

The reason your test is failing is what Jonny stated in the comments. You are waiting for the page to be ready immediately after the log in action, which is already 'ready' as you have just interacted with it. What you want to do is do an implicit wait on the log off element. This can be done with a couple different methods.

wait.Until(ExpectedConditions.ElementExists(By.XPath(xpath)));

wait.Until(ExpectedConditions.ElementExists(By.CssSelector(csspath)));

Either one of these will perform an implicit wait on the page, waiting up to 30 seconds (as defined in your wait element) for the log off element to be found.

Pseudo Sudo
  • 1,402
  • 3
  • 16
  • 34
  • The issue is that its not doing waits at all so waiting on an element won't work either, I think this could be a bug in the marionette driver. – Jonny Ngan Aug 31 '16 at 10:52