WebElement element = driver.findElement(By.cssSelector("#username"));
// Locate an element with a specific class name WebElement element = driver.findElement(By.cssSelector(".my-class")); // Locate an element with a specific attribute value WebElement element = driver.findElement(By.cssSelector("[data-test='my-value']"));Overall, the org.openqa.selenium.By.cssSelector package is a powerful tool for locating elements on a webpage using CSS selectors.