Monday, 24 February 2014

Finding Elemnts in a Web Page

There are 8 ways to locate the element in the web page
  1. Class Name
  2. Css Selector
  3. Id
  4. Link Text
  5. Name
  6. Partial Link Text
  7. Tag Name
  8. Xpath

Xpath


Xpath is categorized in two types
1 . Absolute Xpath
2 . Relative Xpath

Let us write the xpath based on the given example

Writing absolute xpath for the above
/select/option[1]

Writing relative xpath for the above
//select[@option='volvo']

Note
Difference between Absolute xpath and Relative xpath : Absolute xpath will start with root path(/) where as Relative xpath will start from the current path.


Will add more content soon.....


No comments:

Post a Comment