Learn Selenium With Quiz – Advance Level 7 – XPath – Make Selenium Easy
Please select 2 correct answers
//a[contains(@href,’http://’)] //a[contains(@href=’http://’)] //a[contains(href,’http://’)] //a[contains(@href,”http://”)]
“contains()” is a XPath method which can be used to check value of an attribute or text of web element containing a particular character or string. “contains()” takes two arguments. First argument is for attribute name or text. Second argument is value to check for. If you are passing an attribute, you need to use @ symbol before attribute name. If you use text, you need to pass text() method.
Please select 2 correct answers
//a[contains(@text(),’Women’)] //a[contains(text()=’Women’)] //a[contains(text(),’Women’)] //a[contains(text(),”Women”)]
“contains()” is a XPath method which can be used to check value of an attribute or text of web element containing a particular character or string. “contains()” takes two arguments. First argument is for attribute name or text. Second argument is value to check for. If you are passing an attribute, you need to use @ symbol before attribute name. If you use text, you need to pass text() method.
//a[@title=’Women’ and @class=’sf-with-ul’] //a[@title=’Women’ AND @class=’sf-with-ul’] //a[@title=’Women’ & @class=’sf-with-ul’] //a[@title=’Women’ && @class=’sf-with-ul’]
Logical operators can be used to locate a web element with its multiple attributes. You can locate a web element by using its multiple attribute using “and” and “or”. Remember here that both keywords are case sensitive.
//a[@title=’Women’ or @class=’sf-with-ul’] //a[@title=’Women’ OR @class=’sf-with-ul’] //a[@title=’Women’ | @class=’sf-with-ul’] //a[@title=’Women’ || @class=’sf-with-ul’]
Logical operators can be used to locate a web element with its multiple attributes. You can locate a web element by using its multiple attribute using “and” and “or”. Remember here that both keywords are case sensitive.
Please select 2 correct answers
//a[(@title=’Women’ and @class=’sf-with-ul’) @href=’http’] //a[(@title=’Women’ and @class=’sf-with-ul’) OR @href=’http’] //a[(@title=’Women’ and @class=’sf-with-ul’) or @href=’http’] //a[((@title=’Women’ and @class=’sf-with-ul’) or @href=’http’)]
Logical operators can be used to locate a web element with its multiple attributes. You can locate a web element by using its multiple attribute using “and” and “or”. Remember here that both keywords are case sensitive.
//a[contains(title,’Women’) and @class=’sf-with-ul’] //a[contains(@title,’Women’) and @class=’sf-with-ul’] //a[contains(@title=’Women’) and @class=’sf-with-ul’] //a[contain(@title,’Women’) and @class=’sf-with-ul’]
Logical operators can be used to locate a web element with its multiple attributes. You can locate a web element by using its multiple attribute using “and” and “or”. Remember here that both keywords are case sensitive.
//a[contains(@title,’Women’)] | //a[@class=’sf-with-ul’] //a[contains(@title,’Women’)] & //a[@class=’sf-with-ul’] //a[contains(@title,’Women’)] || //a[@class=’sf-with-ul’] //a[contains(@title,’Women’)] OR //a[@class=’sf-with-ul’]
We can select the union of all nodes selected by XPath expr1 and all nodes selected by XPath expr2. Remember we do not have any thing for intersection of xpath expressions. We need to use pipe symbol ( ‘|’ ) to find union.
Please select 2 correct answers
//a[starts-with(@title=’Women’)] //a[starts-with(@title,’Women’)] //a[starts-with(title,’Women’)] //a[starts-with(@title,”Women”)]
starts-with() is a XPath method which can be used to check value of an attribute or text of web element starts with a particular character or string.
last() method gives you the last element from array of elements. You must need to group before applying any filter. “//img[last()]” and “//img” will give you same results.
We can use position() method to get a particular indexed element from an array of elements.
Learn Selenium With Quiz – Advance Level 7 – XPath