多任务处理selenium以立即获取数据以降低时间复杂性python(异步任务处理)

2021-05-16 08:15:18 发布

您现在位置:Python中文网/ 问答频道 /正文

下面给出了一个反复调用selenium过程的示例程序。请帮助我学习如何执行多处理/多线程(多任务)。在

urls= [consider 10 urls]
def selenium(urls)
    driver = webdriver.PhantomJS(desired_capabilities = dcap,service_args=['--ignore-ssl-errors=true', '--load-images=false'])
    driver.get(url)
    some_process()

for i in urls:
    selenium(i)

Task here is to run all the given urls in one shot at same time with different background panthomjs browsers
Asynchronous processing of links.