Selenium IDE 1.1.0 - testing javascript mouseover menu

1,455 views
Skip to first unread message

nap0leon

unread,
Aug 12, 2011, 3:37:25 PM8/12/11
to Selenium Users
Any advice for a newbie?

I am testing a typical top-Nav menu (5 tabs, when you hover over each
tab and sub-menu appears).

The pertinent part of my test script looks this:
<tr>
<td>verifyNotVisible</td>
<td>//html/body/div/div/div/ul[2]/li/ul/li</td>
<td></td>
</tr>
<tr>
<td>mouseOver</td>
<td>/html/body/div/div/div/ul[2]/li/a</td>
<td></td>
</tr>
<tr>
<td>waitForVisible</td>
<td>//html/body/div/div/div/ul[2]/li/ul/li</td>
<td></td>
</tr>

The issue is the last piece - where I am trying to verify that the sub-
menu became visible.
If I let the script run on its own, waitForVisible returns "[error]
Timed out after 30000ms"
If I manually mouseOver the tab, the sub-menu appears and the test
passes.

Much appreciated!!!!

nap0leon

unread,
Aug 12, 2011, 5:23:26 PM8/12/11
to Selenium Users
Btw, I've determined that the css that makes the sub-menu apper is
"hover" not "mouseOver". Can this css be invoked with selenium or
must I force the css change, and if so, how would I do this?

Thanks.

nap0leon

unread,
Aug 15, 2011, 9:19:32 AM8/15/11
to Selenium Users
I got it to work... placing the answer here in case anyone else is
having a similar issue.

1- verifyNotVisible(submenu element's XPath) - verifies the submenu is
not visible when the page loads (useful to prevent false-positives in
case the later test to verify it is visible)
2- mouseOver(mainmenu element's XPath) - mouse over to the heading in
the menu you want to hover over
3- mouseMove(mainmenu element's XPath) - move the mouse at the same
location as step 2
4- waitForVisible(submenu element's XPath) - wait for the submenu to
appear

<tr>
<td>verifyNotVisible</td>
<td>//html/body/div/div/div/ul[2]/li/ul/li</td>
<td></td>
</tr>
<tr>
<td>mouseOver</td>
<td>//html/body/div/div/div/ul[2]/li/a</td>
<td></td>
</tr>
<tr>
<td>mouseMove</td>
<td>//html/body/div/div/div/ul[2]/li/a</td>

moshe_s

unread,
Aug 16, 2011, 1:24:31 AM8/16/11
to Selenium Users
I want to be able to test the ToolTip that I have on my WEB page.
Will this work also with in the case of a ToolTip ?

nap0leon

unread,
Aug 16, 2011, 8:55:46 AM8/16/11
to Selenium Users
The technique above is how I was able to trigger a ".hover" CSS change
in visibility.

If your ToolTip is an actual element on the page that uses .hover to
change visibility (e.g., a div that is hidden and then becomes visible
using visibility:visible or display:inline) then this approach should
work.
Reply all
Reply to author
Forward
0 new messages