Complete the code to select the first child element using CSS pseudo-class.
element = driver.find_element(By.CSS_SELECTOR, 'ul li[1]')
The :first-child pseudo-class selects the first child element of its parent.
Complete the code to select all even child elements using CSS pseudo-class.
elements = driver.find_elements(By.CSS_SELECTOR, 'div.item[1]')
The :nth-child(even) pseudo-class selects all even-numbered children.
Fix the error in the code to select the last child element using CSS pseudo-class.
element = driver.find_element(By.CSS_SELECTOR, 'table tr[1]')
The correct pseudo-class is :last-child with a hyphen, not :lastchild.
Fill both blanks to select every 3rd child starting from the first using CSS pseudo-class.
elements = driver.find_elements(By.CSS_SELECTOR, 'ul li[1]([2])')
The :nth-child(3n+1) selects every 3rd child starting from the first.
Fill all three blanks to select all list items except the first and last using CSS pseudo-classes.
elements = driver.find_elements(By.CSS_SELECTOR, 'ul li:not([1]):not([2])[3]')
Using :not(:first-child):not(:last-child):nth-child(n) selects all list items except the first and last.