My webpage taking close to 5 minutes to complete the process after clicking a button.
I am using the following code to perform the click
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://www.example.com")
element = driver.find_element(By.CLASS_NAME, ".buttoncls")
element.click()
120 seconds after the click is performed, I am getting the timeout error at the python end.
In playwright I am able to specify the timeout as parameter to click function call. Is there any such option here in selenium.
I googled for "selenium equivalent for playwright click timeout"
I got the below code snippet through Gemini
wait = WebDriverWait(driver, 10) # 10-second timeout for the wait
try:
element = wait.until(EC.element_to_be_clickable((By.ID, "your_element_id")))
element.click()
except TimeoutException:
print("Element not clickable within the specified timeout.")
Here it gives an option to wait for X seconds before the element becomes clickable. But in my case it has to wait for 5 minutes post clicking the button. There is no issues in identifying and clicking the button. The issue props up after clicking the button.