Skip to content Skip to sidebar Skip to footer

Python Using Selenium To Click On A Button Based On Type, Value, And Class

So this is what the html looks like:

With . we are directly pointing to parent in html hierarchy and * allows you to do a search without depending on any specific tag

Solution 2:

A solution could be:

buttons = self.driver.find_elements_by_xpath("//title[contains(text(),'Next')]")
actions = ActionChains(self.driver)
time.sleep(2)
actions.click(button)
actions.perform()

Documentation on Selenium Action Chain here: http://selenium-python.readthedocs.org/en/latest/api.html#module-selenium.webdriver.common.action_chains

Post a Comment for "Python Using Selenium To Click On A Button Based On Type, Value, And Class"