30 Questions
Which type of locator is used to find elements by their ID?
XPath
What is the key characteristic of Absolute XPath?
It is a complete path from the root element
Which type of XPath expression is preferred as it is not a complete path from the root element?
Relative XPath
Which method is used to find dynamic elements in Selenium WebDriver?
ancestor
What does the Contains() method do in XPath expression?
Finds elements with partial text
What attribute can be used in the Contains() method to find elements with partial value?
Type
Which type of XPath expression is used to select nodes based on attributes like ID, Name, and Classname?
Basic XPath
Which statement best describes XPath in Selenium?
XPath is used for navigation through the HTML structure of a web page.
What type of documents can XPath be used for in Selenium?
Both HTML and XML documents
When would XPath be used in Selenium automation?
When elements are not found by general locators like id, class, name, etc.
What is the basic format of XPath in Selenium?
XPath=//tagname[@attribute='value']
What does the '@' symbol represent in XPath?
Select attribute
What does the '//' symbol represent in XPath?
Select any descendant node
What is the purpose of XPath in Selenium?
To navigate through the HTML structure of a web page
Which axis is used to select all children elements of the current node in XPath?
Child
Which axis is used to select all nodes that come before the current node in XPath?
Preceding
Which axis is used to select the following siblings of the context node in XPath?
Following-sibling
Which axis is used to select the parent of the current node in XPath?
Parent
Which axis is used to select the current node itself in XPath?
Self
Which axis is used to select the descendants of the current node in XPath?
Descendant
What are the two types of Selenium XPath?
Absolute XPath and Relative XPath
Which type of XPath is used to find an element on the web page based on its attributes?
Absolute XPath
What are XPath Axes used for?
To find dynamic elements
Which attribute value is used in the XPath expression '//*[contains(@id,'message')]'?
id
What does the XPath expression '//*[contains(text(),'here')]' find?
Links that have the text 'here'
In an OR expression, what is the condition for an element to be selected?
At least one condition should be true
What does the XPath expression '//input[@type='submit' and @name='btnLogin']' find?
Elements with the attribute 'type' equal to 'submit' and the attribute 'name' equal to 'btnLogin'
What does the XPath expression '//label[starts-with(@id,'message')]' find?
Elements with the attribute 'id' starting with 'message'
What does the XPath text() function locate elements based on?
The text of the element
What does the XPath expression '//*[text()='UserID']' find?
Elements with the text 'UserID'
Test your knowledge of XPath in Selenium WebDriver with this complete tutorial. Learn how to use the "contains" function to locate elements with specific attributes or text values. Boost your skills in XPath expression writing and enhance your web automation capabilities.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free