swaaz / InstaBot

Instagram bot built using Python and Selenium
38 stars 13 forks source link

Implementing sleep without affecting the others #20

Closed autumnlewjb closed 4 years ago

autumnlewjb commented 4 years ago

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.

swaaz commented 4 years ago

issue: #19

swaaz commented 4 years ago

@autumnlewjb Thanks for the pull request :) Would love to work with you

autumnlewjb commented 4 years ago

Same here @swaaz . I learned a lot from your code as well. All the best.