I am having issues with trying to automate a test to select a date from a datepicker (without a date input field). I have searched and seen several examples, one specifically states you can use it with By.CssSelector, i am unsure however what exactly needs to be specified in this.
This is the HTML:
<td class="dpTD" onmouseout="this.className="dpTD";"
onmouseover="this.className="dpTDHover";"
onclick="updateDateField('03/04/2012', '2', '3', '3', '2012');">3</td>
This is the C#:
WebDriver.FindElement(By.CssSelector("inputtexthere")).Click();
It looks like you can select it by its class:
Or if there’s more than one cell with that class, try narrowing it down with
:contains():Or even an attribute substring selector:
I’m just throwing suggestions out here as there’s not enough markup to work with. If you’ve worked with CSS, you can use almost any selector with Selenium.