Unable to click on button when the date picker is appeared on the screen

Scenario: enter the future date using setText in date field and need to click on the button. then error message should thrown “enter today or prior date”

script is executing successfully but I am not able to see the error message. I am guessing the date picker is overriding the button. can someone share your suggestions what could be the exact cause for not displaying the message?

Note: above scenario is working as expected if I do it manually.

or

is there a way to make the date picker to disappear?

Broadly speaking, you have two choices:

  1. Click somewhere outside the datepicker. This will usually remove focus from it and hide it.

  2. Send/trigger a blur event on the datepicker element.

First choice is probably easiest.

To advise you any further I need a lot more information. Read this post for ideas: