How can I get this line

elem = WebDriverWait(driver,10).until(EC.visibility_of_element_located((By.CSS_SELECTOR,lastTweetCss))) 

to move on further in the code if it doesn't find anything after waiting for 10 sec?

Edit: I'm looking to scroll down the site till it hits the bottom (which works currently) and then when the above-mentioned line starts waiting as there are no more further posts to scroll, I'm looking to get it to ignore the Timeout and continue with the rest of the script.

I'm looking to scrap the tweets off a specific twitter site bound by dates and I want it to stop after scrolling to the bottom.

My code: http://pastebin.com/tDgG0JHT

  • Not sure if I understand the problem. You want to scroll to the bottom or you want to continue after wait? What are you trying to do here? Feb 9, 2016 at 13:52

1 Answer 1


try...except block will allow you to bypass the timeout. But if you need that you are doing it wrong. Check presence of element before you wait of it's visibility.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.