I am writing a Selenium test to populate a date field on a webpage. The field is associated with a JQuery Date Picker. When I use the ‘type’ function to enter the date, the picker pops up. However, I cannot get it to go away, even if I shift focus, click on another field etc. I’ve tried the following till now…
# Python Code
# Setting the date in the field
sel.focus('tradeDate')
sel.type('tradeDate', '8/16/2011')
# Trying to get rid of the date picker popup, none of these work
sel.key_press('tradeDate', '5') # Trying to TAB out
sel.focus('link=[Search Filters]') # Trying to set focus to something else
sel.focus('searchDirectory') # Trying to set focus to another text field
sel.fire_event('tradeDate', 'blur')
sel.click('//span[@onclick="toggleTradeDetails(\'14859\',this);"]')
None of the above seem to work. I am not actually trying to test JQuery. The ‘tradeDate’ field has its own onClick event define, which is what I am actually trying to test.
Thus, how can I get rid of the date picker pop-up. I’m using Selenium RC against IE 8
I solved this issue by using the mouseMove, mouseDown & mouseUp selenium commands to move to a different field on the page, which gets rid of the date picker