jeudi 26 janvier 2017

How to navigate to a page in Selenium without waiting for AJAX responses

How the page I'm trying to test works is

  1. Open page
  2. A button is supposed to be disabled
  3. An AJAX request that was sent on page load finishes
  4. The button is enabled

However, when I try to do something like

driver.Navigate().GoToUrl("https://thepage.com"); 
Assert.IsFalse(driver.FindElement(By.Id("the-button")).IsEnabled());

the problem is that the AJAX request has finished between the first and second lines and therefore I can't properly test that the button is disabled at first. Is there any way to do a Navigate().GoToUrlWithoutWaitingForAnything or any hack I could use to do this test?

Aucun commentaire:

Enregistrer un commentaire