| || |
Verify the order of web links
Dose anyone knowh how I can check the order of links on a webpage?
If I have a section in a webpage with 10 links, I want to verify that these links always is displayed in the same correct order.
I have tried to use 'Visual relation identifier', but that didn't work as I expected.
And I get this error, of course: "The selected test object sannot be used as a related object, because other objects are defined as related objects for it"
If the link names are standard then you can get the link names and verify them, then you can able to verify all links are in order or not
If they are in a webtable then can be easily verified, Provide more info on your ques
Use DP to get the links and compare using the name as per your order
You might be able to use the links index if they are static within the number of links on the page, here's an example (using 4 links to keep it simple)
expectedLinkOrder = "Mr;Mrs;Miss;Dr;"
actualLinkOrder = ""
For i = 0 To 3
actualLinkOrder = actualLinkOrder & Browser(X).Page(Y).Link("index:="&i).GetRopRoperty ("innerText") & ";"
If expectedLinkOrder = actualLinkOrder Then
What I have done in the past is captured expected order values and if not in the correct order sort them and failed if any missing values but only warn if all values are present but the order is incorrect.
The method Mark has suggested could be the best way to check the order any point of time..but it will be more easy if they are all defined in a webtable.
Also are you try to check the alignment part as well as you were using the Visual Relation Identifier?