2013-02-11 21 views
0

我想知道如何從使用Watir Webdriver的頁面中選擇日曆日期。Watir Webdriver/Ruby如何JavaScript選擇onclick(日曆)

我測試的網址是:http://dev01-new.firestonecompleteautocare.com/appointment/schedule-appointment.htm?execution=e2s4

你必須去第三步,以選擇一個日曆日期。

我試圖選擇包括執行腳本的日曆的各種方式,但似乎沒有任何工作。

browser.execute_script("DP_jQuery_1360620655913.datepicker._selectDay('#choice1\\-date',1,2013, this);return false;") 

任何幫助,非常感謝。

+1

您是否有腳本進入第三步?如果我們能夠重現問題,這將更容易幫助。還解釋你所嘗試的和結果將確保我們不會重複你的努力。例如,你嘗試點擊鏈接或表格單元格嗎?似乎很奇怪,你的第一個方法是使用execute_script。 – 2013-02-12 04:07:30

回答

0

有用於顯示日期的表格單元格的onclick屬性:

<td onclick="DP_jQuery_1360625373055.datepicker._selectDay('#choice1\\-date',1,2013, this);return false;" class=" "><a href="#" class="ui-state-default">13</a></td> 

您應該能夠使用fire_event方法在這種情況下。例如:

browser.link(:id => "foo").fire_event "onclick"