I am currently dabbling in Python in combination with Selenium. I can't get any further at one point.
Enclosed you can see three screenshots. At https://www.easycredit.de I already click on the button (1). After that I get to the next page. I would like to click this button (2) now. In Screenshot 3 you can see the location in the source code.
# link to Chromedriver
browser = webdriver.Chrome('/usr/local/bin/chromedriver')
button = browser.find_element(By.CLASS_NAME, 'econ-button btn btn-primary')
button.click()
The error:
NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":".econ-button btn btn-primary"}
(Session info: chrome=104.0.5112.79)
Here are my questions:
- hy does it not work with this code?
- How do you find out with which procedure it works best in a case like this?
- How do you choose whether to identify an element by XPATH, ID etc.?
Thanks