I've replaced some of the sleep with WebDriverWait and wait until an _expectedcondition arises. This could potentially reduce the running time of Selenium as unnecessary wait - to be accurate - sleep could be avoided based on different users' experience. It could also prevent the ElementNotFoundException that would arise (when the browser tries to load the webpage but program is trying to find the element during the load) due to insufficient sleep time as users may have different connnection speed.
With WebDriverWait we could set the maximum waiting time so that once exceeded, it most probably due to HTTP error as the time could be long enough. It will not affect the normal users' experience in normal circumstances.
I've replaced some of the sleep with WebDriverWait and wait until an _expectedcondition arises. This could potentially reduce the running time of Selenium as unnecessary wait - to be accurate - sleep could be avoided based on different users' experience. It could also prevent the ElementNotFoundException that would arise (when the browser tries to load the webpage but program is trying to find the element during the load) due to insufficient sleep time as users may have different connnection speed. With WebDriverWait we could set the maximum waiting time so that once exceeded, it most probably due to HTTP error as the time could be long enough. It will not affect the normal users' experience in normal circumstances.