Search code examples
javascriptseleniumselenium-rc

Selenium: Getting xpath of element with the help of property such as link


I want to know is it possible to get xpath of the element such that link="Edit".

Using selenium can i achieve this.

Explanation :

I know that on page there is link with with text "Edit". So using selenium i can locate it dynamically such that link="Edit" but now i have this link in my RC and want to loop it using its xpath so that i can get contents in the same row where link is present.

I want to achieve these kind of things in different scenarios and with different elements. I should be able to get the xpath, id, css of elements using attributes of elements.

Please help, let me know is it possible using some java-script or else I am using Selenium RC with PHP. If possible i should be able to integrate things.

Thanks in advance.


Solution

  • i don't know about "on the go" creating of xpath, but this is an xpath equivalent for link="Edit" in Selenium:

    //a[contains(text(), 'Edit')]/..