Make Selenium Easy

Learn Selenium With Quiz – Basic Level 8 – CSS Selector

As a part of a Series of posts on Learn Selenium With Quiz, This set contains questions from CSS Selector concepts in Selenium WebDriver. I will suggest you to go through below link before taking up quiz:

CSS Selector in Selenium WebDriver

Quiz will be auto submitted once you answer all question.

How to represent any child (Child and Subchild) of a parent node using CSS selector?

Correct! Wrong!

All child of a parent node will include all immediate child and child of child. We can represent all child of node using a whitespace . For e.g. "div input" will locate all input child of div tag.

What is the correct css selector to locate an element using its an attribute?

Correct! Wrong!

The CSS syntax of locating an element using its attribute is below:- tagName[attributeName='attributeValue']. Remember here that we do not use '@' symbol like XPath here.

What is the correct css selector to locate an element using its multiple attributes?

Correct! Wrong!

The CSS syntax of locating an element using its multiple attribute is below:- tagName[attributeName='attributeValue'][attributeName='attributeValue']....... Add more attribute with its value in similar fashion. Remember here that we do not use '@' symbol like XPath here.

Which element is represented by CSS "#someValue"?

Correct! Wrong!

In CSS, we can locate an element with its id using '#'. For example if an input tag has an id with value "firstName", CSS will be #firstName.

Which element is represented by CSS ".someValue"?

Correct! Wrong!

In CSS, we can locate an element with its class using '.'(dot) . For example if an input tag has a class with value "firstName", CSS will be .firstName.

What is difference between input#someValue and #someValue?

Correct! Wrong!

'#' is short notation to represent id. input#someValue :- All input tags with id as someValue #someValue :- All tags with id as someValue

What is difference between input.someValue and .someValue?

Correct! Wrong!

',' is short notation to represent class name. input.someValue :- All input tags with class as someValue .someValue :- All tags with class as someValue

What is represented by css "input[id^='someValue']"

Correct! Wrong!

'^' represent starts with.

What is represented by css "input[id$='someValue']"

Correct! Wrong!

'$' represents ends with.

If you find this helpful, please share with others.

#ThanksForSharing

Author: Amod Mahajan

A software Tester who is paid to judge products developed by others. Currently getting paid in American Dollars. Writing technical posts and creating YouTube videos are my hobbies.

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.