Your SlideShare is downloading. ×
Advance xpath
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Advance xpath

1,123
views

Published on

Advance Xpath Processing

Advance Xpath Processing

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,123
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
41
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Advance Xpath Processing Suresh
  • 2. What is Xpath XPath is a syntax used for selecting parts of an XML document The way XPath describes paths to elements issimilar to the way an operating system describes paths to filesXPath is almost a small programming language; it has functions and expressions XPath is a W3C standard
  • 3. Html page
  • 4. Using contains to search text
  • 5. Using starts-with to search attribute value /html/body/div/table[3]/tbody/tr/td
  • 6. Using Operator//div[contains(@class,pagination)]//a[contains(.,>) and not(contains(.,|))]
  • 7. Using Functions //td[contains(.,Chapter)][position() =2] //td[contains(.,Chapter)][2]
  • 8. Axes (outline View)Starting from a given node, the self, preceding, following, ancestor,and descendant axes form a partition of all the nodes
  • 9. Axes (outline View) SelfPreceding
  • 10. Axes (outline View) Following Ancestor
  • 11. Axes (outline View) Descendant
  • 12. Selecting using xpath Selecting from dropdown listdriver.findElement(By.xpath("//select/option[contains(.,pc)]")) Selecting radio button driver.findElement(By.xpath("//input[contains(@id,red) and @type=radio]")).click(); Selecting checkbox driver.findElement(By.xpath("//input[contains(@name,vehicle) and contains(@value,Nothing)]")).click();
  • 13. Advantage of smart xpath processing Test case to click first chapterdriver.findElement(By.xpath(“/html/body/div/table[3]/tbody/tr/td”)).click(); or driver.findElement(By.xpath(“//td[contains(.,Chapter)][1]”)).click();  Maintenance is easy  Debugging is easy  Saves time and energy  Reduces the documentation time