1

I think that I may be asking something that has been answered, But I really can't tell. (a-hem) Here's my problem (This is an example... my site is behind a login) Go to www.humana.com. Hover over the text "Insurance Through Your Employer >" You will note that it was "hiding" more options... (But is not a classic dropdown menu) Say, I want to test the products-and-services function (not the actual page, but how this menu works.... no fair dodging the Q (grin)) If I try "clickAndWait" with "link=products-and-services" I get an error, because the test tool can't "see" the element.... (PHPUnit user, if it helps)

Is there a way to have the "mouse" "Hover" over element "A", and then, "Select/Click" on Element "B"?

Everseeker
  • 11
  • 3
  • Have you tried the [Actions](http://webcache.googleusercontent.com/search?q=cache:l76m8wu5-lIJ:selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/interactions/Actions.html+&cd=3&hl=en&ct=clnk&gl=in) class? – Shahid M Zubair Dec 04 '14 at 07:40
  • Check these posts: [selenium webdriver: mouseOver and PHPUnit](http://stackoverflow.com/questions/8384087/selenium-webdriver-mouseover-and-phpunit), [Selenium 2 (WebDriver) and Phpunit?](http://stackoverflow.com/questions/4206547/selenium-2-webdriver-and-phpunit) – Shahid M Zubair Dec 04 '14 at 07:44

1 Answers1

0

To answer your question as it was mentioned in the title:

In your browser, open the drop-down, while the inspector is ON, click on one of its elements so that you will be guided to the right section of the HTML code. You should be directed to a set of ul, li tags. Having the XPath found in this way, a single command like the example below should serve the goal:

command:

clickAt

Target:

//ul[@id='select-area-map-menu']/li[2]

To answer your hover and click question:

Use clickAt command in the same way (but NOT for the select tag). For instance:

clickAt   |  //a[@id='button-id']  | 

This will click on a drop-down as if a user cliked on it to open. You can use many commands to trigger many actions then. For instance, mouseDown command to click. However I think the first part of my answer is enough if the problem is that the drop-down was hidden.

I was dragged here by google since I had the same question. I am not an expert but I hope this answer works for others just fine.

Azim
  • 1,596
  • 18
  • 34