Sam
Sam

Reputation: 543

How to create an XPATH for the dynamically changing properties

When users logs in , I can see the below html source. I'm trying to implement click operation for the "Change Password" link using Webdriver in C#.

When user 1 Login , the below sample code generates for change password link:

<td> <a href="../../siteagent/pw/ser.fcc?SENC=UTF-8 &TSON=34&TARGET=/uas/authaction/slogin.do&[email protected]"> <img src="/u/default/img/global/change_password.gif;jsessionid=xxxxxxxEA57DB0A9F754B53A6E" width="92" height="15" alt="Change Password" border="0"></a></td>

When user 2 Login , the below sample code generates for change password link:

<a href="../../siteagent/pw/ser.fcc?SMENC=UTF-8 &amp;TSON=34&amp;TARGET=/uas/authaction/slogin.do&amp;[email protected]">Change Password</a>

Upvotes: 0

Views: 146

Answers (1)

murali selenium
murali selenium

Reputation: 3927

You can you OR in xpath so that any user xpath will work:

//img[@alt='Change Password']|//a[contains(text(),'Change Password')]

Upvotes: 2

Related Questions