I'm trying to get clickable elements from a UIWebView based on coordinates ("What is at coordinate x,y?"), retrieve information about them ("Is it a link? Where does it go?"), and then programmatically click them, and I've run across a couple of problems.
elementFromPoint(x,y) works wonderfully in terms of getting the elements at a given location, but if I have, for example, a <span> inside an <a> then the span is reported instead of the <a>. Is there any way to get around this? Or to go to the parent above this element, but at the same coordinates, if it's not clickable?
Also, click() works great for buttons, but not for links. How would I simulate a mouse click (or a tap) on a link, or a mouseover? I tried onmouseover() on the elements, but that didn't work.
Alternatively, is there any kind of mouse object on the page that I could programmatically move around and that would do what I want?