Complete the code to find an element by CSS selector.
WebElement element = driver.findElement(By.[1](".button"));
id or name instead of cssSelector for CSS selectors.The cssSelector method is used to find elements by CSS selector in Selenium.
Complete the code to find an element with class 'active' using CSS selector.
WebElement activeElement = driver.findElement(By.[1](".active"));
id or tagName instead of cssSelector.To find elements by class name using CSS selector, use cssSelector with a dot prefix.
Fix the error in the code to correctly find an element by CSS selector.
WebElement element = driver.findElement(By.[1]("#submit-btn"));
name or className for CSS selectors with #.The selector #submit-btn is a CSS ID selector, so cssSelector must be used.
Fill both blanks to find an element with tag 'input' and attribute 'type' equals 'text' using CSS selector.
WebElement inputField = driver.findElement(By.[1]("[2]"));
xpath or className instead of cssSelector.Use cssSelector with the selector input[type='text'] to find input fields of type text.
Fill all three blanks to find a button element with class 'submit' and text 'Send' using CSS selector.
WebElement sendButton = driver.findElement(By.[1]("[2]")); String buttonText = sendButton.getText(); assertEquals("[3]", buttonText);
xpath instead of cssSelector.Use cssSelector with button.submit to find the button by class, then check its text is 'Send'.