Click Anywhere on the Screen

1,452 views
Skip to first unread message

Craig

unread,
Oct 8, 2007, 12:19:39 AM10/8/07
to selenium-users...@googlegroups.com
I apologize if I've missed something fundamental but....

I'm trying to set up a test that clicks on an anchor element (among other things).

However, there are two problems with going the conventional way:
1. the element is dynamically generated so it's ID cannot be guaranteed;
2. It is deeply embedded in the page and I haven't been able to figure out reliable and unique xpath for it.

What I can rely on is the position of the link, so I would like a command that does a mouse click at x=104, y=242 relative to the top-left of the viewport.

I have tried the following without success:
- clickAt, using //body as the target and 104,242 as the value
- a combination of mouseMoveAt, mouseDownAt and mouseUpAt with the same arguments as the click.
I can only assume at this point that the mouse events are happening directly on the body, and not to the 'screen'.

Alternatively I do know the innerHTML of the anchor element, so if there is a technique that utilizes the innerHTML to find the anchor element, then that would also be useful.

Note I am working within Selenium IDE, v 0.8.7.

Thanks in advance for your assistance.

ax.

vv

unread,
Oct 8, 2007, 7:35:03 AM10/8/07
to selenium-users...@googlegroups.com
Try to use smth like this

{code}
<td>click</td>
<td>css=div:contains("some text")</td>
<td></td>
{code}

I suggest you to use *css* locators because xpath locators is too slow in IE6. Maybe you will like this http://www.zvon.org/xxl/XPathTutorial/General/examples.html URL

Craig

unread,
Oct 8, 2007, 9:32:16 PM10/8/07
to selenium-users...@googlegroups.com
That does the trick - as long as we're careful about where we use it.

Thanks :)

Reply all
Reply to author
Forward
0 new messages