0
for i in range(len(tlds)):
    #print("TLD at index " + str(i) + " is " + tlds[i])
    try:
        print("Cerca sito...")
        sito = WebDriverWait(driver, 0.2).until(EC.presence_of_element_located((By.XPATH, "//div[contains(text(),'" + str(tlds[i]) +"') and @class ='Io6YTe fontBodyMedium']"))).text
    except:
        #print("T1")
        sito = None
    if sito is not None:
        print("T2")
        break

Here is the code: the part that is taking me so long is sito=... it cycles correctly through the loop but takes so much

I printed the result of site and actually it's correct: prints the tlds[i] between quotation marks but just takes so long.

Prophet
  • 32,350
  • 22
  • 54
  • 79
  • It could help if you shared a bit more context: what kind of data is it parsing? How big is the file that you are searching in, and where does it come from? Also sharing some more information about how long it takes (seconds? minutes? half an hour?) could help people give you better advice. – Anna-Chiara Bellini Feb 01 '23 at 23:05

1 Answers1

0

In an an end-to-end test there were a lot of variables at play, a couple of examples can be Sauce startup, Browser start up and latency to and from the application under test, which may not be visible through the naked eye. Hence the delay.

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352