Absolute xpath

An absolute XPath expression provides the complete path from the root of the document to the desired element. While absolute XPath expressions are less recommended than relative XPath expressions (as they are more prone to breaking when the structure of the page changes), you can construct an absolute XPath by listing all the elements from…

Relative xpath: use of Contains()

In Selenium with Java, the contains() function in XPath is useful when you want to locate an element based on a partial match of its attribute value.  I have copied the following HTML code from the link- https://en.wikipedia.org/w/index.php?title=Main_Page&action=history There are multiple title attributes with the value containing the word ‘Help’. Here I have located those…

Relative xpath : General syntax

I have copied the following html code snippet from the link – https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&returnto=Form Here input is a tag and id is an attribute with value=wpEmail.It indicates a text box for email input. We shall go to the text box and write the email address there. To do the same we shall use the following xpath…

Selenium CssSelector : Part III [ hash(#) notation ]

In Selenium WebDriver, the hash (#) notation is used in CSS selectors to identify an HTML element by its unique ID. Syntax: tag: Represents the HTML tag of the element. #: Denotes the hash notation to target an element by its ID. idValue: The specific ID value of the element you want to target. For…

Selenium, CssSelector : Part II [dot(.) notation]

In Selenium, the dot (.) notation is used in CSS selectors to represent a class. This notation allows you to select elements based on their class attribute. For example, if you have an HTML element like this: I have taken this code snippet from this link- https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&returnto=Form . It indicates a text-box to enter password…