selenium多进程

时间:2017-04-01 13:19:59   收藏:0   阅读:1092
import os
import multiprocessing

1、获取Chromedriver驱动动态路径
webdriver.Chrome(executable_path=os.path.join(os.getcwd(), "chromedriver.exe"))
2、等待特地(label)网页元素加载完毕,返回真
is_disappeared = WebDriverWait(dr, 30, 1, ignored_exceptions=TimeoutException).until(lambda x: x.find_element_by_id("label").is_displayed())
3、多进程
if __name__ == ‘__main__‘:
  multiprocessing.freeze_support()
  
pool = multiprocessing.Pool(processes=3)
  
for i in range(2):
    pool.apply_async(func,args=(args,))
  pool.close() 
  pool.join()



评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!