Verifying properties of hovered element

54 views
Skip to first unread message

Eugene

unread,
Sep 17, 2009, 8:30:12 AM9/17/09
to selenium-users...@googlegroups.com
I need to check actual properties of page elements. Including colors, background-colors and so on.
Used toolset: Selenium-RC + PHPUnit.
I use document.defaultView.getComputedStyle (currentStyle for IE) for determination actual visual parameters.

There is a problem when :hover css-rules are in use on the page. In this case I can't emulate mouse overing in full.
$this->mouseOver(location) does not cause appliance of :hover css-rules.
initMouseEvent() (fireEvent() for IE) does not cause appliance of :hover css-rules too.

What is the correct way of verifying properties of hovered element?

Eugene

unread,
Sep 18, 2009, 3:40:34 AM9/18/09
to selenium-users...@googlegroups.com
Did not say but tried to use.
There were problems with Firefox 2 when using this method: events do not occure.
In any case it does not solve the problem: :hover styles do not apply when using it.

There is simple test that could clearly see the problem.

*Test steps:*
1. Open the http://openqa.org/ in Fx with Selenium IDE and Firebug
2. Expect the Selenium link in the Project tab. It has a:hover {color:red} style and it is red when hovering it.
3. Open the Firebug and type
document.getElementById("menu").getElementsByTagName("a")[0].onmouseover = function(){this.style.backgroundColor = "grey";};
<Enter>
to add simple mouseover event handler to this link.
4. Open the Selenium IDE. Type and execute the command
mouseOver&nbsp;&nbsp;&nbsp;&nbsp; //a[@href="http://seleniumhq.org/"]

*Actual result:*
The link is blue with grey background.
*Expected result:*
The link is red with grey background.

If you know any workaround that allows Selenium to apply :hover style rule to the link please write. I believe it would be answer to my question.

Reply all
Reply to author
Forward
0 new messages