On Wed, May 26, 2010 at 3:44 AM, Sascha <saschaschwa
...@yahoo.de> wrote:
> Hi,
> I have been required to verify that the things done onmouseover are
> correctly done in our GUI. These are visual things that are defined in
> CSS using :hover.
> Selenium (I am using the Core based way via RC) has a method mouseOver
> that does fire a mouseover event but does not get the :hover rule
> active. Others also ran into this problem:
> - http://groups.google.com/group/selenium-users/browse_thread/thread/a6...
> - http://groups.google.com/group/selenium-users/browse_thread/thread/85...
> I am having here an implementation that would support this, but only
> for Firefox Chrome (I am using this on FF3/3.5/3.6). I know that there
> are other calls that do not work (the same) on different browsers. I
> have not yet opened an issue for that as I would first like to here
> your opinions on such browser specific implementations.
> Here is what I am doing:
> /**
> * Overwrites the original mouse out function and additionally
> deactivates the pseudo class :hover in Firefox Chrome
> *
> * @param {String} locator an element locator
> */
> Selenium.prototype.doMouseOut = function(locator) {
> var element = this.browserbot.findElement(locator);
> this.browserbot.triggerMouseEvent(element, 'mouseout', true);
> if(browserVersion.isChrome) {
> var domUtils = Components.classes["@mozilla.org/inspector/dom-utils;
> 1"].getService(Components.interfaces.inIDOMUtils);
> // check if :hover is currently active
> if(0x04 & domUtils.getContentState(element)) {
> domUtils.setContentState(element.ownerDocument.documentElement,
> 0x04);
> }
> }
> };
> /**
> * Overwrites the original mouse over function and additionally
> activates the pseude class :hover in Firefox Chrome
> *
> * @param {String} locator an element locator
> */
> Selenium.prototype.doMouseOver = function(locator) {
> var element = this.browserbot.findElement(locator);
> this.browserbot.triggerMouseEvent(element, 'mouseover', true);
> if(browserVersion.isChrome) {
> // set the :hover to active
> var domUtils = Components.classes["@mozilla.org/inspector/dom-utils;
> 1"].getService(Components.interfaces.inIDOMUtils);
> domUtils.setContentState(element, 0x04);
> }
> };
> --
> You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
> To post to this group, send email to selenium-developers@googlegroups.com.
> To unsubscribe from this group, send email to selenium-developers+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/selenium-developers?hl=en.