Menu Close

How to click on a button with Python Selenium?

Sometimes, we want to click on a button with Python Selenium.

In this article, we’ll look at how to click on a button with Python Selenium.

How to click on a button with Python Selenium?

To click on a button with Python Selenium, we can use the click method on the returned element.

For instance, we write

from selenium.webdriver import ActionChains

ActionChains(browser).click(element).perform()

to create an ActionChains object with the browser object.

Then we call click with the button element.

And then we call perform to do the click on element.

Conclusion

To click on a button with Python Selenium, we can use the click method on the returned element.

Posted in Python, Python Answers