Quality Testing

Quality is delighting customers

how to uniquely identify dynamically changing elements locator/ xpath using Selenium RC?

Hi,

    I am using Selenium RC  with Java. I am testing gmail. I am able to locate the static elements and can successfully run the script. But when any mail comes into Inbox, its path changing, so

how to uniquely identify dynamically changing elements locator/ xpath using Selenium RC?

 

Regards,

susmitha

Views: 1282

Reply to This

Replies to This Discussion

E.g. xpath=//a[contains(.,'some text')]  is one way to identify links which does not have anything else static but the text between the tags. So that would identify for example any component which has code <a href="....whatever">some text</a> as well as <a href=".....">this is some text</a>. Same contains-function can be used to any parameter inside the tags.

(With quick peek to GMail to identify the "unread topic" from page happens with //b[contains(.,'the topic')]) or you can use even //b[.='the topic'] which searches for all <b> tags which has exactly "the topic" -content.

Thanks for your reply.

But when i am trying to record the clicking on a particular mail through Selenium IDE , it's not recording.

How to click on  a particular mail  form displayed list?

So i used FireBug to get the xpath of the particular mail element and used as

selenium.click('xpath of a particular mail using FireBug');

selenium.click("//*[@id=':oa']");

When i executed this one , i didn't get any exception.

But I am unable see click on a particular mail and viewing its description.

 

Recording is ALWAYS the bad way to make test automation. I've checked many recording system and they all are bad. No matter if it is QTP or Selenium IDE. If you want to make maintainable test automation, use some manual way to automate things. E.g. I'm usually using Robot Framework with Selenium Library. It needs more time to learn, but after you've learned it, you will save plenty of time ifwhen the application is changing.

you can use xpath ,

contains ,innertext . install firebug & firepath in firefox so that you can check it .

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service