Picking Start and End date from date picker

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Picking Start and End date from date picker

santhub4u
Scenario -Click on the field to get the calendar popup and select the current date which is highlighted, then click on the arrow to select end date and click on the end date.





CSS – Selected date


CSS – For clicking on the arrow to move to next month


CSS – Target end date in next month



C# code using Selenium webdriver
driver.FindElement(By.CssSelector("div.date-block")).Click(); //Clicks on the date start and End date
 driver.FindElement(By.CssSelector(".datepickerSelected")).Click();
driver.FindElement(By.CssSelector(".datepickerGoNext")).Click();
driver.FindElement(By.CssSelector("xxxxxxxx")).Click();

Question:
Can someone help me in providing the C# code to pick the start and End dates please.
Reply | Threaded
Open this post in threaded view
|

Re: Picking Start and End date from date picker

softwaretestingforum
Administrator
santhub4u wrote
Can someone help me in providing the C# code to pick the start and End dates please.
Hi Santhu

This is going to be tricky to use calendar control to select required date.
In such situations I always suggests to select to type the date, so -

is date field editable? and even if it is not you could still execute java script to type in date.

~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Picking Start and End date from date picker

santhub4u
Hi Tarun,

The date field is not editable, we have make the selections with in the popup, are you suggesting to execute the javascript with in the C# code generated by the webdriver?

Is there any alternative to get it from the CSS selectors?

Thanks
Santhu
Reply | Threaded
Open this post in threaded view
|

Re: Picking Start and End date from date picker

softwaretestingforum
Administrator
Yes the java script execution.
Problem with calendar - date pick operation is that it is extremely tedious to identify their position from month to month
~ seleniumtests.com