I'm trying to create a bot that auto refreshes and stops whenever the desired element is available to click/visible. I've made the refresh part and the bot stops when it sees the desired element, but I just can't figure out why it doesn't click on the element:/
Error log
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome(executable_path="C:\selenium drivers\chromedriver.exe")
driver.get("xxx")
driver.maximize_window()
click = driver.find_element_by_xpath('//*[@id="coiPage-1"]/div[2]/div[1]/button[1]')
click.click()
while True:
try:
element = WebDriverWait(driver, 2).until(EC.presence_of_element_located((driver.find_element_by_xpath('//*[@id="siteContainer"]/div[6]/div/div[3]/div[1]/div[2]/div/div/div[2]/div[2]/div[3]/div[2]/form/button'))))
driver.find_element_by_xpath('//*[@id="siteContainer"]/div[6]/div/div[3]/div[1]/div[2]/div/div/div[2]/div[2]/div[3]/div[2]/form/button').click()
break
except TimeoutException:
driver.refresh()
continue