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,460 points
1,216 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,920 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How can I perform mouse hover to a web element with ruby and selenium webdriver?

Hi Siddhart, checkout the following script to ...READ MORE

answered Aug 26, 2019 in Selenium by Abha
• 28,140 points
2,597 views
0 votes
2 answers

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

Hello Nitin, as the Like button on ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,140 points
5,444 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 28, 2018 in Selenium by nsv999
• 5,500 points
5,148 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, 2019 in Selenium by Amod Mahajan
4,001 views
0 votes
2 answers

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,500 points
13,676 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,144 views
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,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP