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 a direct child of a parent node using CSS selector?

Correct! Wrong!

Direct child is immediate child of a node. For example:- A Son of a father will be direct child. We can represent a direct child of node using '>'. For e.g. "div > input" will locate all direct input child of div tag.

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

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

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.
%d bloggers like this: