mjgirl
mjgirl

Reputation: 1234

Selenium Webdriver and Firefox 18

My Selenium tests use onMouseOver features like

 List<WebElement> menuitems = getDriver().findElements(By.tagName("li"));
    Actions builder = new Actions(getDriver());
    WebElement menu = menuitems.get(2);
    getDriver().manage().timeouts().implicitlyWait(Constants.IMPLICITY_WAIT, TimeUnit.SECONDS);
    builder.moveToElement(menu).build().perform();

I'm using Firefox driver. Since Firefox updated itself to version 18, my tests stopped working. I know this has to do with native events support - but does not version 18 support native events, or am i able to enable them? If not, is there any replacing implementation to my code?

I'm using selenium java 2.28.0.

Upvotes: 9

Views: 10099

Answers (5)

Manoj Lonar
Manoj Lonar

Reputation: 11

I was facing the same issue with Firefox 20. Then I re-installed latest Selenium server (.jar files).

http://selenium.googlecode.com/files/selenium-server-standalone-2.32.0.jar

Hope this works!

Upvotes: 0

Andrew
Andrew

Reputation: 11

My hover-over broke with v28. I now use the following hoverOver method with an optional javascript workaround and it seems to work okay.

    public void HoverOver(IWebElement elem, bool javascriptWorkaround = true)
    {
        if (javascriptWorkaround)
        {
                String code = "var fireOnThis = arguments[0];"
                    + "var evObj = document.createEvent('MouseEvents');"
                    + "evObj.initEvent( 'mouseover', true, true );"
                    + "fireOnThis.dispatchEvent(evObj);";
                ((IJavaScriptExecutor)driver).ExecuteScript(code, elem);
        }
        else
        {
            Actions builder = new Actions(driver);
            builder.MoveToElement(elem).Build().Perform();
        }
    }

Upvotes: 1

user1987809
user1987809

Reputation: 51

For Firefox 18 support we need use selenium webdriver api 2.28.0,jar.

Upvotes: 5

user1971071
user1971071

Reputation: 11

Rolling back to FF17 is a temporary work around until WebDriver version supports FF18

FF17 Extended Support Release packages -- http://www.mozilla.org/en-US/firefox/organizations/all.html

Note: If you are Mac user, you can simply rename your current FF from 'FireFox' to 'FireFox18' in your applications folder. Install the package from the above URL, which should create a new application called 'FireFox' that will be used by WebDriver.

Upvotes: 1

niharika_neo
niharika_neo

Reputation: 8531

Selenium Java 2.27 mentions that native support for FF17 has been added. However, there has been no mention of support for FF18 in the change logs for 2.28. So its webdriver not supporting native events and not FF18 not supporting native events. You can try downgrading to FF 17 and probably turn off automatic updates for some time.

Upvotes: 1

Related Questions