Update wait_for_condition to address StaleElementException
Update tests that use wait_for_condition to avoid StaleElementException
Pep8 fixes