I use simple code as
[FindsBy(How = How.CssSelector, Using = "div[id=1]")]
private IWebElement _plasticOption;
to find element with id = 1.
It's for page factory, if someone don't know what it is, we can change the code above to the next one:
IWebElement element = driver.FindElement(By.CssSelector("div[id=1]"));
So, this simple code can't find an element in the next piece of HTML:
<div class="b-wide-option disabled" data-bind="css: { selected: IsSelected, disabled: !IsVisible() }, click: Select, attr: { id: Id }" id="1"> </div>
But I can simply find this element the next way:
[FindsBy(How = How.Id, Using = "1")]
private IWebElement _plasticOption;
And I actually wonder why I can't find this element using CssSelector.
I have:
selenium webdriver v.2.43.1
chromedriver v. 2.10
Chrome Brovser v. 37.0.2062.120
#symbol for the id? eg,By.CssSelector("div#1")?