Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Advanced Objects. Agenda 2 Working with Websites & Applications ScriptOnce Helpful XPath Tips."— Presentation transcript:

1 Advanced Objects

2 Agenda 2 Working with Websites & Applications ScriptOnce Helpful XPath Tips

3 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

4 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 id’s 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.

5 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")] //button[contains(@label,"fecto")] –This will make the script more robust for small changes

6 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. – //button[@resourceid=“someid" or @label=“somelabel"]

7 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- sibling::text[@label="Password"]]

8 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

9 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]

10 Thank You


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

Similar presentations


Ads by Google