Selenium and :hover css

后端 未结 2 1992
面向向阳花
面向向阳花 2020-12-11 02:35

Using selenium-rc and the java client, I want to test a menu which opens when the user moves the mouse over it. It closes when the mouse leaves the menu. This is done using

相关标签:
2条回答
  • 2020-12-11 03:12

    I couldn't find a way to do this using the Selenium interface. However, since I am using Selenium 2, I can use the WebDriver API, as per http://groups.google.com/group/selenium-developers/msg/8210537dde07155f?pli=1

    In your case, something like this may work, if you can upgrade to Selenium 2:

    WebDriver webDriver; 
    ...
    ((RenderedWebElement) webDriver.findElement(By.cssSelector("div#navi_settings"))).hover();
    
    0 讨论(0)
  • 2020-12-11 03:21

    The mouseOver method will activate a :hover pseudoclass.

    0 讨论(0)
提交回复
热议问题