I am trying to parallelize the execution of a loop which retrieves data from a website using selenium. In my loop I loop over a list of URLs URLlist
I created before.
Firstly I log in to the page and thus create an instance of the webdriver.
browser = webdriver.Chrome(executable_path='chromedriver.exe')
browser.get('https://somepage.com')
username = browser.find_element_by_id("email")
password = browser.find_element_by_id("password")
username.send_keys("foo@bar.com")
password.send_keys("pwd123")
browser.find_element_by_id("login-button").click()
Then my loop starts and calls some functions which operate on the page.
for url in URLlist:
browser.get(url)
data1 = do_stuff()
data2 = do_other_stuff()
I don't quite know where to start because I can imagine that I need an instance of the webdriver for each thread.
What is the right (and maybe easiest) way to do this?