Forum Discussion

PhilippeS's avatar
PhilippeS
New Contributor
2 years ago

How to manually fire an event

Hello, 

For a web application, I need to set specific dates in multiple "Date Picker" components.

Unfortunately, the datePicker doesn't allow to directly set the date

So I need to write a logic to click on the date picker, then select the year, then select the month, select the day....

I would like to avoid this logic by manually set the value on the object and then manually fire the Event using the method  "dispatchEvent'

 

For example in a javascript script : 
Aliases.browser.mainPage.PlannerFrame.textboxDatenavDatepickerInput.value = '01/10/2022';
Aliases.browser.mainPage.PlannerFrame.textboxDatenavDatepickerInput.dispatchEvent(new Event('change'));

 

But the script doesn't know the "Event".  
How can create en Event ?
Is there another way to do it ?

 

Thank you in advance

Regards