Reputation: 1
I am writing a code that will hopefully be able to click on a defined button on a pop-up window. The pop-up window appears only after having clicked somewhere else (this part is working).
here's the code:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
wait = WebDriverWait(driver, 2)
wait.until(EC.element_to_be_clickable((By.XPATH, '//button\[text()="OK"\]')))
wait.until(ExpectedConditions.visibilityOfElementLocated(By.XPATH, '//button\[text()="OK"\]'))
wait.until(ExpectedConditions.elementToBeClickable(By.XPATH, '//button\[text()="OK"\]'))
driver.findElement(By.XPATH, '//button\[text()="OK"\]').click()
I am getting an error "TimeoutException". Anyone able to fix that?
thanks a lot
Upvotes: 0
Views: 67