I am trying to click a button on a website in Python using Selenium. The html looks like this:
<a class="btn btn-default btn-lg primary-light-blue-btn" onclick="createReport()">Create report</a>
I have tried using:
l = driver.find_element(By.XPATH, "//button[@class='btn btn-default btn-lg primary-light-blue-btn']")
But I get the error:
NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//button[@class='btn btn-default btn-lg primary-light-blue-btn']"}
I have also tried other things, but it just won't find the button. E.g.:
l = driver.find_element(By.XPATH, "//button[text()='Create report']")
I have also tried introducing a wait, but that does not help, e.g.:
l = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[text()='Create report']")))