edx/edx-platform — pull request #758 by JonahStanley (2013-08-21 13:19:06+00:00)
Title: Made the lambda statement more resistant to errors

Suggested Reviewers: @wedaly @jzoldak

The error that is being returned in the console on jenkins is ElementNotFoundException.

From the splinter documentation
'If element not found, find methods returns a empty list. But, if you try, access a element in list raises the splinter.element_list.ElementDoesNotExist exception.'

Thus, the lambda statement will not return false as predicted.

This change will instead use css_text (which prevents some type of errors) and a try, except block around this.

The try except block is to catch the following scenario:
css_text calls retry_on_exception. However, retry_on_exception asserts that the function worked within a certain amount of attempts. While this is fine in most cases, if the page is taking a while to load (on sauce or on jenkins), the attempts will run out due to how quickly they are fired and an assertion error will rise. In that case, I want the webdriver to wait a second for the page to continue to load.

I will run the this branch as many times as I can today to see if this fixes the issue.