Selenium and :hover css

0 votes

I want to test a menu which opens when the user moves the mouse over it. It closes when the mouse leaves the menu. How can I do this using Selenium-rc and Java?

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.

Sep 19, 2018 in Selenium by Meci Matt
• 9,400 points
99 views

1 answer to this question.

0 votes

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();
answered Sep 19, 2018 by Sushmita
• 6,850 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

Python & Selenium: How to find and click on YouTube's Like button

Use the CSS Selector button to like: #watch8-sentiment-actions ...READ MORE

answered Mar 26, 2018 in Selenium by nsv999
• 5,050 points
536 views
0 votes
1 answer

Selenium + Java - drag and drop not working on selenium 3.8

How about you try adding the below ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,050 points
1,346 views
0 votes
1 answer
0 votes
2 answers

How different/ similar are Protractor and Selenium? Which is better?

Protractor and Selenium both are used to ...READ MORE

answered Jun 9 in Selenium by Amod Mahajan
1,237 views
0 votes
1 answer

What's the diff between Selenium RC and Selenium WebDriver?

RC works by injecting the JavaScript functions ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,050 points
167 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
423 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
777 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
416 views