0
0
Selenium Javatesting~20 mins

CSS selector syntax in Selenium Java - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
CSS Selector Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
selector
intermediate
2:00remaining
Identify the element selected by this CSS selector
Given the HTML snippet below, which element will be selected by the CSS selector div.content > ul#list > li.item.active?
Selenium Java
<div class="content">
  <ul id="list">
    <li class="item">Item 1</li>
    <li class="item active">Item 2</li>
    <li class="item">Item 3</li>
  </ul>
  <ul id="other-list">
    <li class="item active">Item A</li>
  </ul>
</div>
AThe <li> element with text 'Item A' inside the <ul> with id 'other-list'
BThe <li> element with text 'Item 2' inside the <ul> with id 'list'
CAll <li> elements with class 'item' inside any <ul>
DThe <ul> element with id 'list'
Attempts:
2 left
💡 Hint
Look for the direct child combinator (>) and the id selector (#list).
selector
intermediate
1:30remaining
Which CSS selector matches all buttons except those with class 'disabled'?
Choose the CSS selector that selects all
Abutton:not(.disabled)
Bbutton.disabled
Cbutton > .disabled
Dbutton + .disabled
Attempts:
2 left
💡 Hint
The :not() pseudo-class excludes elements matching the selector inside it.
selector
advanced
2:30remaining
What is the output of this CSS selector in Selenium?
In Selenium Java, what element will be found by the CSS selector input[type='checkbox']:checked + label?
Selenium Java
<input type="checkbox" id="check1" checked>
<label for="check1">Option 1</label>
<input type="checkbox" id="check2">
<label for="check2">Option 2</label>
AThe <input> elements that are unchecked
BAll checked checkbox inputs
CAll <label> elements regardless of checkbox state
DThe <label> immediately following a checked checkbox input
Attempts:
2 left
💡 Hint
The + combinator selects the next sibling element.