- vidyasagar
- Posts : 3
Join date : 2010-05-10
How to verify all elements present in application.
Fri May 14, 2010 1:39 pm
I know the procedure if all elements in a page have ids associated with..but what if they don't have ids...in that case how can i verify all the elements present in page/application..can i find the xpaths of all elements{buttons,inputs,fields etc..}..can anyone please explain in detail
Thanks in advance,,
Regards,
Vidyasagar
Beginner in selenium
Thanks in advance,,
Regards,
Vidyasagar
Beginner in selenium
- metmanAmateur
- Posts : 58
Join date : 2010-04-02
Re: How to verify all elements present in application.
Fri May 14, 2010 11:19 pm
Yup, you can use xpaths. You can also use xpaths relative to id. Also, you can identify elements by other attributes than ID, if they have them. In general, follow the pattern foo[@bar='baz']/xpath where foo is the element type, bar is the name of an attribute, and baz is the value for the attribute you are trying to target. Xpath is of course the relative xpath from that targeted element. If you have multiple elements that have the same attribute, you can use the standard square bracket formatting to index whichever element with that attribute value you want.
- vidyasagar
- Posts : 3
Join date : 2010-05-10
A solution
Sat May 15, 2010 11:28 am
@metman ..thanx for ur reply..but it wont work if i want to store all anchor elements with //a...but having different ancestors...
finally i find a way to solve this issue...here it is...
1.find the no. elements using xpathcount (here we are trying to find all anchor elements...i.e."//a"
2.now try to click the anchor element by
/descendant::a[1]
/descendant::a[2]
/descendant::a[3]
/descendant::a[4]
...........................
/descendant::a[last()] or /descendant::a['xpathcount']
finally i find a way to solve this issue...here it is...
1.find the no. elements using xpathcount (here we are trying to find all anchor elements...i.e."//a"
2.now try to click the anchor element by
/descendant::a[1]
/descendant::a[2]
/descendant::a[3]
/descendant::a[4]
...........................
/descendant::a[last()] or /descendant::a['xpathcount']
Permissions in this forum:
You cannot reply to topics in this forum