1 / 52

Xpath In Selenium Webdriver | Selenium Xpath Tutorial | Selenium Tutorial For Beginners |Simplilearn

This presentation on XPath in Selenium will help you learn the basics of XPath in Selenium. In the process, you shall see the syntax of XPath and several types of XPath locators. After that, we shall understand what the two types of XPaths with their respective syntax are. Then we shall learn about the XPath Functions and the types of XPath Functions. Towards the end, we shall see the XPath Axes, their relevance, and different XPath Axes in Selenium.<br><br>The topics covered in the video are:<br>1. What is XPath in Selenium?<br>2. Types of XPath<br>3. XPath Functions<br>4. Types of XPath Functions<br>5. XPath Axes<br><br>Post Graduate Program in DevOps:<br>This program, designed in collaboration with Caltech CTME, prepares you for a career in DevOps, bridging the gap between software developers and operations teams. Our unique Blended Learning combines live online classes, interactive labs and more, giving you hands-on experience and job-ready skills. This Post Graduate Program in DevOps will help you master the art and science of improving the development and operational activities of your entire team. You will build expertise via hands-on projects in continuous deployment, using configuration management tools such as Puppet, SaltStack, and Ansible.<br><br>u2705 Caltech CTME Post Graduate Certification<br>u2705 Receive 25 CEUs from Caltech CTME upon course completion<br>u2705 Caltech CTME Circle Membership<br>u2705 Online Convocation by Caltech CTME Program Director<br>u2705 Master classes with Caltech CTME instructors<br>u2705 Physical Certificate from Caltech CTME (on request)<br>u2705 250 hours of Applied Learning<br>u2705 Enrollment in Simplilearnu2019s JobAssist<br>u2705 Get noticed by the top hiring companies<br>u2705 20 real-life projects on integrated labs<br>u2705 Capstone project in 3 domains<br><br>Learn more at: http://bit.ly/3nc827A

Simplilearn
Download Presentation

Xpath In Selenium Webdriver | Selenium Xpath Tutorial | Selenium Tutorial For Beginners |Simplilearn

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What is XPath?

  2. What is XPath?

  3. Click here to watch the video

  4. What is XPath? • XPath is a Selenium technique used to navigate through the HTML structure of the webpage • It uses the XML path expression to find elements on a webpage <xpath>

  5. What is XPath? • XPath is a Selenium technique used to navigate through the HTML structure of the webpage • It uses the XML path expression to find elements on a webpage <xpath>

  6. Syntax of XPath

  7. Syntax of XPath XPath = //tagname[@Attribute = ‘Value’]

  8. Syntax of XPath Select Current node XPath = //tagname[@Attribute = ‘Value’]

  9. Syntax of XPath Select Current node XPath = //tagname[@Attribute = ‘Value’] Tagname like input

  10. Syntax of XPath Select Current node Selects Attribute XPath = //tagname[@Attribute = ‘Value’] Tagname like input

  11. Syntax of XPath Select Current node Selects Attribute XPath = //tagname[@Attribute = ‘Value’] Tagname like input Attribute Name

  12. Syntax of XPath Select Current node Selects Attribute Value of the attribute XPath = //tagname[@Attribute = ‘Value’] Tagname like input Attribute Name

  13. Types of XPath Locators There are several types of XPath Locators

  14. Types of XPath Locators There are several types of XPath Locators

  15. Types of XPath Locators There are several types of XPath Locators

  16. Types of XPath

  17. Types of XPath

  18. Types of XPath There are two types of XPaths

  19. Types of XPath There are two types of XPaths

  20. Types of XPath There are two types of XPaths Absolute XPath

  21. Types of XPath There are two types of XPaths Absolute XPath Relative XPath

  22. Types of XPath Absolute XPath • Absolute XPath is a direct way of finding an element • The drawback is that if there are any changes in the elements path then XPath will fail

  23. Types of XPath Absolute XPath • Absolute XPath is a direct way of finding an element • The drawback is that if there are any changes in the elements path then XPath will fail

  24. Types of XPath Absolute XPath Absolute XPath:/html/body/div[1]/div/div[2]/header/div/div[2]/a/img

  25. Types of XPath There are two types of XPaths: Absolute XPath Relative XPath

  26. Types of XPath Relative XPath • Relative XPath begins from the middle of the HTML DOM structure • It enables writing from the middle of the HTML DOM structure without any need to write a long XPath

  27. Types of XPath Relative XPath • Relative XPath begins from the middle of the HTML DOM structure • It enables writing from the middle of the HTML DOM structure without any need to write a long XPath

  28. Types of XPath Relative XPath Relative XPath://*[@id=”block-perfecto-main-menu”]/ul/li[6]/a

  29. XPath Functions

  30. XPath Functions

  31. XPath Functions • XPath in Selenium provides XPath functions for writing efficient XPaths to discover elements uniquely • XPath Functions helps in locating web elements when there are elements that have similar properties and simple XPath strategies fail

  32. XPath Functions • XPath in Selenium provides XPath functions for writing efficient XPaths to discover elements uniquely • XPath Functions help in locating web elements when there are elements that have similar properties and simple XPath strategies fail

  33. Types of XPath Functions

  34. Types of XPath Functions XPath Contains () • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc.

  35. Types of XPath Functions XPath Contains () • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc.

  36. Types of XPath Functions XPath Contains () • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc //tag_name[contains(@attribute,’value_of_attribute’)]

  37. Types of XPath Functions XPath Contains () • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc

  38. Types of XPath Functions XPath Contains () XPath Text () • The XPath Text() is a function used to locate the element on a web page using the web element's text • The function proves its worth if the element contains a text, like a label, etc. • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc

  39. Types of XPath Functions XPath Contains () XPath Text () • The XPath Text() is a function used to locate the element on a web page using the web element's text • The function proves its worth if the element contains a text, like a label, etc. • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc

  40. Types of XPath Functions XPath Contains () XPath Text () • The XPath Text() is a function used to locate the element on a web page using the web element's text • The function proves its worth if the element contains a text, like a label, etc. • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc //tag_name[contains(@attribute,’value_of_attribute’)]

  41. Types of XPath Functions XPath Contains () XPath Text () • The XPath Text() is a function used to locate the element on a web page using the web element's text • The function proves its worth if the element contains a text, like a label, etc. • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc

  42. Types of XPath Functions XPath Starts-with () XPath Contains () XPath Text () • The XPath Starts-with() function is used to find the element in which the attribute value starts with some specific character • The function plays a major role while working with the dynamic web pages • The XPath Text() is a function used to locate the element on a web page using the web element's text • The function proves its worth if the element contains a text, like a label, etc. • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc

  43. Types of XPath Functions XPath Starts-with () XPath Contains () XPath Text () • The XPath Starts-with() function is used to find the element in which the attribute value starts with some specific character • The function plays a major role while working with the dynamic web pages • The XPath Text() is a function used to locate the element on a web page using the web element's text • The function proves its worth if the element contains a text, like a label, etc. • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc

  44. Types of XPath Functions XPath Starts-with () XPath Contains () XPath Text () • The XPath Starts-with() function is used to find the element in which the attribute value starts with some specific character • The function plays a major role while working with the dynamic web pages • The XPath Text() is a function used to locate the element on a web page using the web element's text • The function proves its worth if the element contains a text, like a label, etc. • The XPath Contains() is a function used to create an XPath expression • It is used if part of the value of any attribute changes dynamically, like login information, etc /tag_name[starts-with(@attribute,’Part_of_Attribute_value’)]

  45. XPath Axes

  46. XPath Axes

  47. XPath Axes • XPath Axes makes it possible to search different nodes in XML document from the current node • These are methods used to find dynamic elements which are not possible to be found by normal XPath

  48. XPath Axes • XPath Axes makes it possible to search different nodes in XML document from the current node • These are methods used to find dynamic elements which are not possible to be found by normal XPath

  49. XPath Axes Some of the axes that help in locating the elements on the webpage are:

More Related