0
Goal: Click 4 times on the same button "See More"
Problem: Click command works the first 2 times, after that, it no longer works and returns TimeoutException
Code:
ops = webdriver.ChromeOptions()
ops.add_argument("start-maximized")
ops.add_argument('disable-infobars')
driver = webdriver.Chrome(options=ops, executable_path='C:\\Users\\danie\\AppData\\Local\\Programs\\Python\\Python37\\chromedriver.exe')
driver.get('https://busca.estadao.com.br/?tipo_conteudo=Not%C3%ADcias&quando=01%2F08%2F2018-01%2F11%2F2018&q=Jo%C3%A3o%20D%C3%B3ria')
for i in range(4):
try:
#"btn-mais" é a classe do botão que quero clicar
driver.execute_script("arguments[0].click();", WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.CLASS_NAME, 'btn-mais'))))
time.sleep(5)
except:
break