This Question is Answered

1 "correct" answer available (4 pts) 1 "helpful" answer available (2 pts)
2 Replies Last post: Jan 9, 2009 6:57 AM by Marco  
Marco Beginner 2 posts since
Jan 8, 2009
Currently Being Moderated

Jan 8, 2009 12:04 PM

Xpath working on Selenium IDE but not on JUnit

Hi All

 

I'm having some problems with Xpath when I'm exporting a test case from IDE to JUnit. When I run on IDE it works fine, but the Junit didn't work as expected.

 

For example, the xpath returned by IDE to a link I'm trying to click was: //body[@id='extranet']/table/tbody/tr[2]/td/div/a/span

I have checked it with XPath checker plugin from firefox and it is ok. But when I run my JUnit test it stops on this line:

 

selenium.click("id('extranet')/table/tbody/tr[2]/td/div/a/span");

 

I have tried to run with *iexplore and with *firefox and both doesn't work.

 

 

I tried to change the Xpath expression to //a[@name='btNewCustomer'] and it also works on IDE and not works on JUnit.

 

Does anyone has a suggestion?

 

Thank you
Marco

bruce Expert 182 posts since
Jul 8, 2007
Currently Being Moderated
1. Jan 8, 2009 7:16 PM in response to: Marco
Re: Xpath working on Selenium IDE but not on JUnit

what's the exception?

 

try  selenium.click("//body[@id='extranet']/table/tbody/tr[2]/td/div/a/span");

More Like This

  • Retrieving data ...