Using the SilkTest Open Agent Recorder, Record the test case as normal

[-] testcase Test1 ()
[ ] Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find("//A[@textContents='Join the experience!']").Select()
 [ ] Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find("//INPUT[@name='Confirm-Button']").Select()
 [ ] //Click on the link named search
 [ ] Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find("//A[@textContents='Search']").Select()
 [ ]
 [ ] Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find("//A[@textContents='Back to main menu']").Select()


Next in SilkTest go to “Record | Window Locators”

Move the mouse over the HTML link named for which you wish to use a different attribute for identifying the object (in this instance the link was named “search”) then press “Ctrl +Alt”.
 


The Locator Spy will launch, under Locator Details click the link “Show additional Locator Attributes”.

 
You will now see some additional attributes which you can use to identify the HTML link named “search”. Using “Ctrl+C” copy the additional attribute and value you wish to use, such as:  href http://localhost/shopitv60/search.asp

Now modify the initial test case to use this new value so that the a find is performed on the attribute href instead of textContents, like so:

[-] testcase Test1 ()
[ ] Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find("//A[@textContents='Join the experience!']").Select()
 [ ] Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find("//INPUT[@name='Confirm-Button']").Select()
 [ ] //Click on the link named search
 [ ]
 [ ] Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find ("//A[@href='http://localhost/shopitv60/search.asp']").Select()
 [ ]
 [ ] Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find("//A[@textContents='Back to main menu']").Select()


Where the previous call:
 
Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find("//A[@textContents='Search']").Select()

Is replaced with:

Desktop.Find("//BrowserApplication").Find("//BrowserWindow").Find ("//A[@href='http://localhost/shopitv60/search.asp']").Select()

Note: If no additional attributes are found by the SilkTest Recorder then it will not be possible to change the attribute from the default attribute.