3

screenshot

The below xpath which is captured for links in selenium IDE is not running in Selenium RC.
The links are designed in XML.

selenium.ClickAt("xpath=/html/body/div/div[2]/ul/li[3]", "");
selenium.ClickAt("xpath=/html/body/div/div[2]/ul[2]/li[2]/span", "");

The links are from the five links we need to click on Administration and from that we need to click on client user.

As Admin-->Client User

  • 1
    can you post the relevant XML/HTML so we can see if there are any improvements that can be made to the XPaths? – rishimaharaj May 29 '12 at 12:27
  • 2
    1. Can you successfully re-run the test in the Selenium IDE after you have closed and reopened the webpage? 2. Try to install and investigate the problem with Firebug Addon – Dmytro Zharii Jun 28 '12 at 19:22
  • What's the xpath given by Firebug or any other html debugger? – Suchit Parikh Sep 27 '12 at 16:40
2

Try using this:

selenium.ClickAt("xpath=//html/body/div/div[2]/ul/li[3]");
1

As per my understanding, I am listing down the below resolutions:

  1. Try to use more specific and short XPath using @id, @class, etc. for the HTML elements.
  2. Use click() instead clickAt().
  3. Use mouseDown() instead of clickAt() - Sometimes this works.

Try with all the above 3 options.

0

You can change the xpath to xpath=//html/body/div/div[2]/ul/li[3]. Also, sometimes the IDE records the xpath but while using them in RC script you will get an error. It's best to use XPather to get the xpath or geting the xpath using Firebug will do good too.

Note: IE sometimes gives problem with xpath. So please try to keep this as your last option.

0

Am i correct in thinking that you have to hover over the menu to see the other elements? If so, the XPath will never work if the elements aren't visible.

Use Actions to perform a hover over the menu item and after that, execute the xpath expression. That should work.

Not the answer you're looking for? Browse other questions tagged or ask your own question.