How to optimize script Here is several tricks to optimize your script: Deny access to images and all unnecessary resources like described here. Use custom waiters, if default waiters fail too much. See this article for info: How to wait on certain event on page. Never use sleep function, only waiters. Use http client instead of browser if possible.