0

i have a problem with selenium and multithread. What i'm try is take links from excel and open them on browser. there is 100+ link in excel. Right now code doing them 1 by 1 it will take too much time and i want to make it faster. With this code right here if i input 50 there will be 50 browser. What i want is when i input 50 or 100 or how many links in excel selenium will open only 5 at time, do a job than close this browser then open next link. How can i limit browser count ? is there any way to do that ?

`

x = int(input("how many links: "))
x = x + 1

wb = load_workbook("site.xlsx")
ws = wb.active
ws = wb["Sayfa1"]
sheet1 = wb['Sayfa1']

def tara1():
    site = ws.cell(i, 1).value
    driver = webdriver.Chrome()
    driver.get(site)
    time.sleep(5)
    driver.close()

i = 1
while i < x:
    print(i)
    i += 1
    Thread(target=tara1).start()

`

NanoForger
  • 21
  • 2

0 Answers0