0

Selenium IDE is able to recognise the ID, Xpath, CSSPath for a link. But, Selenium RC is unable to click on the link using XPath or CSSPath or ID. I have also used "Contains Text()", but of no use. Please find below code that i am currently executing in Eclipse IDE.

selenium.open("https://abc.com");
selenium.type("UserName", "123456");
selenium.click("xpath=//form[@id='loginForm']/table/tbody/tr[7]/td/input");
selenium.click("xpath=//a[@id='_ebg9dd']"); 
// selenium.click("xpath=//a[contains(text(), 'Request Form')]");

Can someone please suggest any other alternative or correct the code if there is any discrepancy ?

Prasad
  • 472
  • 5
  • 15
HemChe
  • 2,249
  • 1
  • 21
  • 33

2 Answers2

1

Are you converting it using the IDE? For example, this is an Xpath selector for Java Junit 4 RC:

Seems unusual to have an id on your a-tag but if you wanted to try using 'contains' this is an example of one that works for me when I just tried it..

selenium.click("//div[@class='span5 footer-links']/ul/li/a[contains(text(), 'Submit your page')]");

I also wonder about the fact that you look to be inputting text into a 'username' field and then followed with two 'clicks'. Do you not need to either input something into another field or wait for something after the first click? Just seems like an odd series of events (may not be though, I obviously don't know the specifics of what it is you're doing.

Dave Goosem
  • 558
  • 8
  • 22
  • Hi Goose, In our application, we do not need to enter any password after Entering user name. So, I am clicking on the login button. After entering the User HomePage, i am clicking on the other link whose xpath is "//a[@id='_ebg9dd']". But i am unable to click the element. i have used "isElementPresent" command in Selenium RC. This command is returning True, which means the element is found. but when i use the command selenium.click("xpath=//a[@id='_ebg9dd']"); the link is not being clicked. The result in Eclipse Console is displayed is "OK" – HemChe Nov 22 '12 at 11:12
0

Try this :

selenium.click("link=name_of_link_present_on_page");
j0k
  • 22,600
  • 28
  • 79
  • 90
prabhakar
  • 51
  • 1
  • 4