For example this statement takes 41 second to perform the Manuel testing:
try:
print("at2-click" + " - Time used=%ss" % int((time.time() - start_time)))
time.sleep(2)
wait_until_visible_then_click(element_by_id)
men_10 = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="product-transaction-area"]/div[1]/div/div/div[2]/div/a[10]')))
men_10.click()
except exp.NoSuchElementException as e:
no_such_element_exption('at2', str(e))
time.sleep(3)
but this statement takes 160 seconds to perform its Manuel testing
try:
print("In den Wb2 product" + " - Time used=%ss" % int((time.time() - start_time)))
time.sleep(2)
element_by_id = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="product-transaction-area"]/div[3]/button')))
except exp.NoSuchElementException as e:
no_such_element_exption('In den Wb2', str(e))
try:
print("ZK" + " - Time used=%ss" % int((time.time() - start_time)))
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
element_by_class = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CLASS_NAME, 'button-big')))
except exp.NoSuchElementException as e:
no_such_element_exption('ZK', str(e))
I prefer to execute this 2nd statement between 50-99 seconds, Can anyone please help to solve this issues
The best solution for me would to avoid using webdriverwait.
You can do some pooling: