python selenium click on button

python selenium click on button

Remove space between classes in css selector:

driver.find_element_by_css_selector(.button .c_button .s_button).click()
#                                           ^         ^

=>

driver.find_element_by_css_selector(.button.c_button.s_button).click()

try this:

download firefox, add the plugin firebug and firepath; after install them go to your webpage, start firebug and find the xpath of the element, it unique in the page so you cant make any mistake.

See picture:
instruction

browser.find_element_by_xpath(just copy and paste the Xpath).click()

python selenium click on button

For python, use the

from selenium.webdriver import ActionChains

and

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

Leave a Reply

Your email address will not be published. Required fields are marked *