Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Learn Selenium With Quiz – Advance Level 7 – XPath – Make Selenium Easy

Posted on 11/04/2019 By admin

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

Uncategorized

Post navigation

Previous Post: March 29, 2017 – Make Selenium Easy
Next Post: February 27, 2017 – Make Selenium Easy

Related Posts

Handling JQuery Dialog Box In Selenium Webdriver Uncategorized
How To Launch Firefox Browser in Selenium WebDriver – Java Uncategorized
cssInConsole – Make Selenium Easy Uncategorized
Advanced TestNG Tutorials 33: Integration and Usage of BeanShell In TestNG XML Uncategorized
image – Make Selenium Easy Uncategorized
image – Make Selenium Easy Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark