在Seleniunm中选择当天

时间:2015-11-19 03:36:39

标签: python datetime selenium-webdriver

我试图打开日历并仅选择特定日历的当前日期(月份,并使用硒)。

到目前为止,我有这个:

#Click on calendar and open the same

self.search_field = self.driver.find_element_by_xpath("//form[@id='searchform']/div/div/div[2]/div/input")
self.search_field.click()

# Get current day

current_date = date.today()
today_day = current_date.day
print today_day

现在我已经有了#34;当天,"我如何选择"当天"在给定的日历内?

[编辑]

日历HTML

<div id="ui-datepicker-div" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" style="position: absolute; top: 151px; left: 222.5px; z-index: 1; display: block;">
<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">
<table class="ui-datepicker-calendar">
<thead>
<tbody>
<tr>
<tr>
<tr>
<tr>
<td class=" ui-datepicker-week-end " data-year="2015" data-month="10" data-event="click" data-handler="selectDay">
<td class=" " data-year="2015" data-month="10" data-event="click" data-handler="selectDay">
<td class=" ui-datepicker-days-cell-over ui-datepicker-today" data-year="2015" data-month="10" data-event="click" data-handler="selectDay">
<a class="ui-state-default ui-state-highlight" href="#">24</a>
</td>
<td class=" ui-datepicker-unselectable ui-state-disabled ">
<td class=" ui-datepicker-unselectable ui-state-disabled ">
<td class=" ui-datepicker-unselectable ui-state-disabled ">
<td class=" ui-datepicker-week-end ui-datepicker-unselectable ui-  state-disabled ">
</tr>
<tr>
</tbody>
</table>
</div>

0 个答案:

没有答案