Oct-19-2017, 02:42 PM
Hi everyone!
I try to runing multiple-task´s in Python with threading, but not run good... when i execute the script, in one web-page is working, while for the others no work...
The Idea for execute in each web-page, independently and unrelated write:
- hello1 + enter
- hello2 + enter
- holla3 + enter
Regards
Karlo_ds
I try to runing multiple-task´s in Python with threading, but not run good... when i execute the script, in one web-page is working, while for the others no work...
The Idea for execute in each web-page, independently and unrelated write:
- hello1 + enter
- hello2 + enter
- holla3 + enter
number = 3 class ScrapHilo: def runningScraper(self,idWeb): global driver global urlWeb try: for ii in range(1,5): driver.get(urlWeb) seleccionar = driver.find_element_by_xpath("//*[@id='lst-ib']") seleccionar.send_keys('Hola'+str(ii)) time.sleep(3) ActionChains(driver).send_keys(Keys.ENTER ).perform() time.sleep(1.5) except: print("Problem...") def __init__(self, number): for i in range(number): hilo = threading.Thread(target=self.abrir_driver,args=(i,), name='hilo_'+str(i)) hilo.start() def abrir_driver(self,numhilo): global uChromeDriver global driver driver = webdriver.Chrome(uChromeDriver) self.runningScraper(str(numhilo)) #driver.quit() ScrapHilo(number)Can you tell me how to work with the thread?
Regards
Karlo_ds