advanced objects. agenda 2 working with websites & applications scriptonce helpful xpath tips

Download Advanced Objects. Agenda 2 Working with Websites & Applications ScriptOnce Helpful XPath Tips

If you can't read please download the document

Upload: joleen-lynch

Post on 18-Jan-2018

214 views

Category:

Documents


0 download

DESCRIPTION

Applications & Websites 3 A Website is usually a single site that devices from all platforms access equally –Websites use different CSS to adapt to different screens and some use responsive design to change layout dynamically –It should be possible to be script once, check that CSS tags are indeed identical –Try out the site on a tablet, phablet and phone from more than one platform to get a feel before coding

TRANSCRIPT

Advanced Objects Agenda 2 Working with Websites & Applications ScriptOnce Helpful XPath Tips Applications & Websites 3 A Website is usually a single site that devices from all platforms access equally Websites use different CSS to adapt to different screens and some use responsive design to change layout dynamically It should be possible to be script once, check that CSS tags are indeed identical Try out the site on a tablet, phablet and phone from more than one platform to get a feel before coding Applications & Websites 4 Applications are different from each other Developed by two different teams; and even though they may attempt to make the apps look the same, this is not their top priority. Check if the ids and object tree have enough in common, reach out to the Development team and try to adopt common conventions to enable one object level script. Tips Using Text 5 Using Text as Anchor Use functions like "starts-with", "contains" when using the text property. //*[starts-with(text(),"Perfe")] //button[contains(text(),"fecto")] This will make the script more robust for small changes Tips ScriptOnce 6 Script Once despite occasionally being unable to find identical objects across platforms When the applications are close enough the ability to say this or that every once in a while allows staying with one script. Tips Hierarchy 7 Use Axes, such as "preceding-sibling", when your object does not have a unique property but another object that is close does. If your textfield is near a text with the label "Password", use //textfield[preceding- Reference XPath hierarchy 8 Axis NameResult ancestorSelects all ancestors (parent, grandparent, etc.) of the current node ancestor-or-selfSelects all ancestors (parent, grandparent, etc.) of the current node and the current node itself attributeSelects all attributes of the current node childSelects all children of the current node descendantSelects all descendants (children, grandchildren, etc.) of the current node descendant-or-selfSelects all descendants (children, grandchildren, etc.) of the current node and the current node itself followingSelects everything in the document after the closing tag of the current node following-siblingSelects all siblings after the current node namespaceSelects all namespace nodes of the current node parentSelects the parent of the current node precedingSelects all nodes that appear before the current node in the document, except ancestors, attribute nodes and namespace nodes preceding-siblingSelects all siblings before the current node selfSelects the current node Tips - Indexes 9 We aim to identify the object regardless of where it is i.e. without an index instead of //group[2]/textfield[1] use //group/textfield Sometimes, there is no unique property / unique tag. Use indexes to create the shortest XPath when Instead of //device/view/group[1]/group[2]/textfiel d[1] use //group[2]/textfield[1] Thank You