Retriving every components xpath

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Retriving every components xpath

Muaaz
Hi ,

I have a requirement that , i want to get all web components xpaths through back end HTML code in the web page.. for example assume this particular web page i want to get all components xpath.(top logo , menus , labels , textboxes , hyperlinks...etc).

The reason i am trying to do this because in our particular webpage , developers are using some js-extension files each and every time when we open the page relevant components id and names are changing , so it is difficult to get particular xpath through firebug , since it has some ID and names relevant xpath also generate with its backend ID or Name.

is there a any particular tool which only generate relevant xpath , without its id's or name's

Thank you ,
Reply | Threaded
Open this post in threaded view
|

Re: Retriving every components xpath

softwaretestingforum
Administrator
You don't always need to use id or name.
You could use xPath to retrieve elements using text of element -

//input[contains(text(),'sometext')]

or can also use Document Object Model (DOM)  for same -

document.findElementsByTagName[0].click()

Both of these can be used by Selenium to exercise elements.
It would help answering if you post short version html of your application.

~ seleniumtests.com