Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a proved mouseOver workaround for FirefoxDriver in Selenium2?
    primarykey
    data
    text
    <p>I'm using <strong>Selenium Java 2.0b3</strong>. I have this code:</p> <pre><code>... WebDriver driver = new InternetExplorerDriver(); Selenium seleniumDriver = new WebDriverBackedSelenium(driver, "http://localhost:8088/Sistema/"); ... ... RenderedWebElement menuRegistrar = (RenderedWebElement)driver.findElement(By.xpath("//a[normalize-space()='Registrar']")); seleniumDriver.mouseOver("//a[normalize-space()='Registrar']"); //makes element visible menuRegistrar.click(); seleniumDriver.mouseOut("//a[normalize-space()='Registrar']"); ... </code></pre> <p>Works like a charm with InternetExplorerDriver (with <strong>IE 8</strong>), but it doesn't with the FirefoxDriver (with <strong>Firefox 4</strong>). I've tried a lot of things with the code and nothing works. And I <strong>must</strong> use the FirefoxDriver because the application I'm testing doesn't behave well with IE.</p> <p>As you might guess, the "Registrar" link is hidden until the mouseOver event triggers.</p> <p>Any proved workarounds? Thanks for your time...</p> <p><strong>EDIT</strong>: also tried ChromeDriver with Chrome 11. Didn't work either. If there's a workaround that works with Chrome I'll take it!</p> <hr> <p><strong>ANSWER (WORKING CODE with Selenium Java 2.0RC1, Windows 7, Firefox 4)</strong>: Thanks to Andy Tinkham and Luke Inman-Semerau:</p> <pre><code>//get the element that shows menu with the mouseOver event WebElement menu = driver.findElement(By.xpath("//div[@id='nav']/li[3]")); //the element that I want to click (hidden) WebElement menuOption = driver.findElement(By.xpath("//a[normalize-space()='Registrar']")); //build and perform the mouseOver with Advanced User Interactions API Actions builder = new Actions(driver); builder.moveToElement(menu).build().perform(); //then click when menu option is visible menuOption.click(); </code></pre> <p><strong>NOTE:</strong> The Advanced User Interaction API uses NativeEvents on the browsers (which is not supported cross platform). So this code might not work just like that if you change the OS. That's why I added the OS and browser detail. See <a href="http://groups.google.com/group/selenium-users/browse_thread/thread/7096b023ffc631fc" rel="nofollow noreferrer">question in selenium users group</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload