Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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

share|improve this question
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

4 Answers 4

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.

share|improve this answer

Try using this:

selenium.ClickAt("xpath=//html/body/div/div[2]/ul/li[3]");
share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

protected by user246 Dec 26 '12 at 22:50

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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