2

I'm a beginner in selenium, and I use a lot of it in my code time.sleep To prevent some EXCEPTIONS.Sometimes it works, but sometimes it doesn't work, and how many seconds of sleep is hard to determine. Is there a smarter way to do it, let my code more pythonic? Thanks.

my pc is ubuntu 16.04, brower is firefox, python is python3.6

drewhaha
  • 25
  • 4
  • 3
    You need to use [Waits](https://selenium-python.readthedocs.io/waits.html) along with [`try`/`except`](https://www.w3schools.com/python/python_try_except.asp) blocks – DonnyFlaw Nov 25 '20 at 09:25
  • @DonnyFlaw is right please check these best practices https://stackoverflow.com/a/59130336/415749 – Sariq Shaikh Nov 25 '20 at 10:59

0 Answers0