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 :hover
css, without any javascript.
In selenium, there are many methods for mouse actions, but none of them seems to trigger any css :hover
style to be used.
Google shows that I am not alone with this problem, but there has not be a solution. Some folks comment that you had to add some javascript code; however, in selenium rc, I don't think that I even have a proper place for user-contributed additional javascript code.
My wish would be the following code to work, given that a div#navi_settings contained the menu which contains the - normally invisible - a element:
selenium.mouseHover("css=div#navi_settings");
assertTrue(selenium.isVisible("//a[contains(text(), 'Text on link')]"));
Unfortunately, the method moveHover()
does not yet exist.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…