Using selenium for the first time here, I was wondering why:
final WebElement justAnId = findElement(By.cssSelector("#someId")); final WebElement whatIWant = justAnId.findElement( By.cssSelector(".aClass.andAnother input[type=text]") );
works, but not:
final WebElement whatIWant = findElement(By.cssSelector( "div#someId.aClass.andAnother input[type=text]" ));
Although they seem equivalent to me, I get:
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":"div#someId.aClass.andAnother input[type=text]"}
Is this supposed behavior or bug in Selenium? I quickly looked at the error tracker in Selenium, but I did not see anything about it. I wanted to ask here before raising a question that should not be. Also, as I understand it, it does not work in IE6, but who cares. I used firefox for this run.
css-selectors selenium-webdriver
Renaud
source share