Search code examples
pythonseleniumgoogle-chromewebdriverclick

click button in python selenium


html codemy code how can click buton in this html code im using selenium.

I'm trying to writing a loop in my admin panel.


Solution

  • first off that button does not have an id='button'

    without seeing the website you could try do something like:

    login_button = driver.find_element(By.TAG_NAME, 'button')
    login_button.click() # this assumes that there are no other buttons on the page as find_element finds the first button on the page
    

    OR

    login_button = driver.find_element(By.CLASS_NAME, 'btn')
    login_button.click() # this assumes that there are no other elements with the `btn` class to click