Contains() and starts-with() function in XPath is used when we are familiar with the pattern of dynamically changing attribute's value of an element on HTML pages. This not only works with dynamic values of any of the HTML attributes but it also works when we want to write XPath on the basis of a partial pattern of any of the attribute. Here I am trying to explain how Contains() and starts-with() function are used in writing XPath.
Now suppose we want to search the Google Search button if we are just familiar with that the value of name attribute, is starting with "btn"
then we have to use function starts-with like this
$x("//input[starts-with(@name,'btn')]")
Similarly, if you are familiar with one string that is related to the attribute value of any tag
then you can write xpath like this
$x("//input[contains(@name,'tn')]")
here name attribute contains one string pattern tn.
To read about this post, read
https://abodeqa.com/contains-and-star...
Watch video Contains and Starts-with function in XPath | How to use contains and starts-with in XPath online without registration, duration hours minute second in high quality. This video was added by user Abodeqa 20 February 2016, don't forget to share it with your friends and acquaintances, it has been viewed on our site 10,219 once and liked it 30 people.