dimanche 28 février 2021

selenium - Selecting dates where the date information of the element is in a different div to the selectable element

Here is the webpage I am trying to write an automated test for:

https://aw1.automationintesting.online/#/

In my test, (not shown), i pass in a month and year and the test clicks through the calendar until the label of the calendar matches the month and year i have passed in.

When i get to the required month year, I want to be able to select a date range whereby i pass in the dates that i want. Here is what i have:

Actions action = new Actions(DriverFactory.getInstance().getDriver());

action.moveToElement(landingPage.date(from))
    .clickAndHold(landingPage.date(from))
    .moveToElement(landingPage.date(to))
    .release(landingPage.date(to))
    .build()
    .perform();

landingPage.date is a selector whereby i find the element by LinkText and pass in the date.

I can see it doing "something" but its not actually selecting the date i pass in.

When I hardcode the selector to a full xpath or cssselector for the the class "rbc-day-bg", it is able to select the date range.

The selector holding the date information and the selector for actually interacting with the calendar are in 2 separate divs.

What selector should i be using to be able to pass in dates to make a selection without hardcoding the selector ?

I hope this makes sense

Thank you in advance

Aucun commentaire:

Enregistrer un commentaire