Forum Discussion
Really sorry for jumping-in, but can't withstand to extend your reply a bit (in square brackets):
Another possible solution is to find [on the page] a JavaScript function to setup a date [and call this function] directly [as described here: http://support.smartbear.com/testcomplete/docs/app-testing/web/general/common-tasks/javascript.html].
Sorry for late response.
But it did not work. But If I write below command in developer tool's console window then it works on browser.
document.getElementById('txtDepartureDate').value = "08/03/2017"
Is it possible to write above Javascript statement into my VBScript Project of TestComplete?
On link https://support.smartbear.com/testcomplete/docs/app-testing/web/general/common-tasks/javascript.html there is solution to run javascript function exist in Application Under Test. How can I execute javascript statement?
Thanks,
Abhay Kulkarni
- baxatob7 years agoCommunity Hero
Hi,
Try to set the value directly. E.g.:
Aliases.browser.yourTargetElement.value = "08/03/2017" where yourTargetElement is the mapped name
of the element with id "txtDepartureDate"- amitkumarlogs5 years agoNew Contributor
baxatob Thank you so much, its working fine for me. It will be really helpful if you could help me out to do it by clicking on particulate date from calender picker.
- baxatob5 years agoCommunity Hero
Hi,
The implementation of clicking on particular date depends on how the date is represented in you datepicker - separate days, months and years, or may be some elements are grouped by some logic. It is difficult to say how to do it without seeing the web element and its properties.
Usually direct setting of the date (using JS or element's value attribute) - the most easy, fast and reliable way.
- amitkumarlogs5 years agoNew Contributor
baxatob I tried to set the value directly using the below piece of code, it display the value in the field once this code runs, but the problem is when I navigate to next page "To find the flights for date 13 sep 19" then I cant see the result for 13 Sep 19. Instead it is showing the flight on basis of current system date. Meaning that its not storing the value which i am providing instead taking the default current date.
var departureDate=page.NativeWebObject.Find("idStr","departureDate"); departureDate.value="13 Sep 19";
Please find the snapshot of my calender
Please help me do select the date from calender as i got stuck to move forward.
- tristaanogre5 years agoEsteemed Contributor
It is possible that there is an "OnExit" event on the data field to make sure that it is updated once you set the value. Examine the events and methods on the object to see if you can find such an event and explicitly call it after setting the value.
Related Content
Recent Discussions
- 3 days agovladd1