How to automate Javascript Datepicker using Selenium Webdriver?

I have a Javascript or jQuery

How to automate Javascript Datepicker using Selenium Webdriver?

Datepicker which looks this way (Please refer the attachment)

The XPath keeps changing  time captured html/body/div[36]/div/div and the XPath during application under test html/body/div[30]/div/div

Please help me in this regards.

Thanks,
SD

Train Asked on October 6, 2015 in Selenium WebDriver.
Add Comment
  • 2 Answer(s)

    Is it a KendoUI? can you send a URL?

    hint: basically these kind of date pickers come with javaScript methods that you can directly invoke to do the necessary action. For example there will be method called SetDate(“01-01-1982”) etc.

    Just invoke this metho via JS executor on webdriver and it should set the date.

    A URL to this UI will help.

    Virender

    Professor Answered on October 6, 2015.

    The date picker used is Pikaday Javascript Datepicker.

    This is how the XPath looks when Firebug is used.

    RE: How to automate Javascript Datepicker using Selenium Webdriver?

    on October 6, 2015.
    Add Comment

    Its a very organized date picker. I think you need to take a look at the tutorials here
    http://www.toolsqa.com/selenium-webdriver/dropdown-multiple-select-operations/

    this talks about the Select class that you have to use to set the correct values.

    Virender

    Professor Answered on October 6, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.