Clicking a link using selenium using python Clicking a link using selenium using python selenium selenium

Clicking a link using selenium using python


As I mentioned in my own question here, the problem would be solved by means of ActionChains class; a brief code is here:

el = driver.find_element_by_id("someid")webdriver.ActionChains(driver).move_to_element(el).click(el).perform()

The main problem is that in some cases, specially when you have a some javascript codes in your page, the DOM would change and the element you've found before will be staled. 'ActionChains' would keep it alive to perform actions on.


You can try to use xpath like below. It is working for me because i have used last project.

driver.find_element_by_xpath("xpath").click()

Please try it...