I'm trying to select a date on my calendar and Nightwatch can't seem to select it properly.
What I'm trying to do is:
document.querySelector("#calendario_inline > div > div > div > select.ui-datepicker-month")
.click()
.pause(100)
.setValue('//*[@id="calendario_inline"]/div/div/div/select[1]', 'OUT')
document.querySelector("#calendario_inline > div > div > div > select.ui-datepicker-year")
.click()
.pause(100)
.setValue('//*[@id="calendario_inline"]/div/div/div/select[2]', '2019')
.pause(100)
.click('//*[@id="calendario_inline"]/div/table/tbody/tr[3]/td[4]/a')
.pause(1000)
Here's the fiddle for my calendar:
EDIT:
It seems the calendar lies within an iframe. You need to access it first. Use this::
client.element("css selector", "#editor > div.panel-v.right > div.panel-h.panel.resultsPanel > iframe", function(response) {
client.frame({ELEMENT: response.value.ELEMENT});
});
And after you're done with the calendar, exit the iframe with .frame(null)
Try this:
For MONTH, to select October (value 9):
client.useXpath().click('//select[@class="ui-datepicker-month"]/option[@value="9"]').useCss();
For YEAR, to select 2019:
client.useXpath().click('//select[@class="ui-datepicker-year"]/option[@value="2019"]').useCss();