Let’s take More complex items: Similarly, if you use /button to discover the XPath for a fruit juice, it will also find the element with the text Fruit. Xpath for the World Wide Market : //button The XPath function contains offers the ability to detect elements containing partial text. contains() is a Selenium function that searches for web elements that contain a specific text within an Xpath expression. The contains() function aids the user in locating elements with partial values or dynamically changing values by verifying matches with a piece of the value. Let’s get started with their working followed by an implementation. We don’t have to enter the entire statement we’re looking for instead, we can write a few words that are unique on the web page. Word: In this case, the word refers to the text that must be discovered in a specific string. Here, tag: tag is the name of the tag that contains the specific word. Here is the declaration of contains in Xpath:ĭriver.find_element_by_xpath(“//tag ”) Web development, programming languages, Software testing & others Start Your Free Software Development Course
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |