The variable element introduces a variable to be used in XPath expression in the subtree of the parent to the variable element. The name of the variable. This is a xsd:QName. [XPath 1.0] expression which is the value assigned to the variable.
How do you write variables in XPath?
String newUser = “NewUser123”; driver. findElement(By. xpath(“//td[normalize-space(text())=**newUser**]/a“)). click();
How do I give a dynamic value to XPath?
- Using Single Slash.
- Using Double Slash.
- Using Single Attribute.
- Using Multiple Attribute.
- Using AND.
- Using OR.
- Using contains()
- Using starts-with()