I have a list of thousands of URLs. I want to use Python/Selenuim to:
- load each URL,
- select one element
- close the page
To make it run faster, I want to run lots of these processes in parallel, but I can only work out how to do it one at a time.
from selenium import webdriver
driver = webdriver.Chrome()
url_list = [
'https://www.instagram.com/p/Bj7NmpqBuSw/?tagged=style',
'https://www.instagram.com/p/Bj7Nic3Au85/?tagged=style'
]
for url in url_list:
driver.get(url)
driver.find_elements_by_class_name("class-name-for-profile-link")
driver.close()
I tried using lots of browser tabs
driver.switch_to.window(driver.window_handles[1])
but the handles are a bit tricky to manage.
How can I run this process in parallel?