WebDriver wait blocks javascript in Firefox

While waiting for a checkbox to reach a certain state, it was observed that the act of waiting (thread sleep) prevented the java script that was setting the checkbox from completing. It seems like this is the issue:
http://www.seleniumwebdriver.com/current-outstanding-issues/firefox-webdriver-blocks-because-of-ajax-call/ What is the solution?

Best Answer

  • Sending an Escape character during the script deadlock will force the javascript to complete and allow normal execution of webdriver tasks.

Answers

  • So you mean if I do this: try { //lambda expression for searching. //wait until checkbox is equal to the expected state new WebDriverWait(driver, new TimeSpan(0, 0, timeout)).Until

    (lambdaFunct => { if(browserName.ToLower().Equals("firefox")) { //this is a firefox hack due to an issue with selenium and firefox blocking if waiting on ajax calls //I have no clue why this works, but it does. checkbox.SendKeys(Keys.Escape); } return checkbox.Selected == expectedStateChecked; }); return true; } catch(Exception e) { return false; } It stops the blocking? Excellent!