Unable to perform click action in selenium python
After some tries like .execute_script("changeTree();")
, .submit()
, etc, I have solved the issue by using the ActionChains
class. Now, I can click in all elements that they have java-script events as onclick
. The code that I have used is this:
from selenium import webdriverdriver = webdriver.Firefox()driver.get('someURL')el = driver.find_element_by_id("someid")webdriver.ActionChains(driver).move_to_element(el).click(el).perform()
I don't know if it occurred just to me or what, but I found out that I should find the element right before the key command; otherwise the script does not perform the action. I think it would be related to staling elements or something like that; anyway, thanks all for their attention.