Answer the question
In order to leave comments, you need to log in
How to test deletion with Selenium?
I find in this way all links to remove images from the page
for i in driver.find_elements_by_xpath("//h4/a"):
print i.get_attribute("href")
i.click()
Answer the question
In order to leave comments, you need to log in
The point is that the click method creates a click event , which has the properties screenX and screenY, that is, it should occur on the "visible" screen. Working through Selenium does not change the fact that the browser and all scripts on the page work with some "visible" screen. Otherwise, one line in js could easily reveal all the deception and the absence of a living person on the other side of the browser.
But find_elements_by_xpath returns all elements of the tree corresponding to the given xpath, regardless of their actual visibility. However, it is not possible to call click on an element outside the "visible" screen.
You can partially solve this problem by calling scrollIntoViewon the element before the click. But this method can also have problems with elements that (or their parents) have style="display:none".
It would be nice to see a piece of DOMa to tell what is wrong.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question