onkeypress="return false;" onpaste="return false;"

onkeypress="return false;" onpaste="return false;"

我的网站不允许我粘贴搜索日期。它在日期字段上设置了 """ onkeypress="return false;" onpaste="return false;" """。

我正在寻找在 python + selenium 而不是 Java 中实现日期选择器的解决方法。网页是http://www.bseindia.com/corporates/corporate_act.aspx?expandable=0

“起始日期”字段编码为

<td height="30" width="73" bgcolor="#ffffff" valign="middle">
  <b>From Date</b>
</td>
<td width="300" height="30" bgcolor="#ffffff">
  <input name="ctl00$ContentPlaceHolder1$txtDate" type="text" id="ctl00_ContentPlaceHolder1_txtDate" class="textbox2" onkeyup="clearText(event,'ctl00_ContentPlaceHolder1_txtDate')" onkeypress="return false;" onpaste="return false;" onclick="showCalendarControl('ctl00_ContentPlaceHolder1_txtDate', 'Div3',false);" style="width:100px;" />
  <img src="../include/images/calender01.gif" id="img2" style="cursor: hand" onclick="showCalendarControl('ctl00_ContentPlaceHolder1_txtDate', 'Div3',false)"
                                    align="middle" alt="Calendar" />
  <div id="Div3">
  </div>
</td>

知道如何自动执行 showCalendarControl 并选择日期吗?

得到解决方案..其实很简单...

driver.find_element_by_id("ctl00_ContentPlaceHolder1_txtDate").click() a = driver.execute_script("return setCalendarControlDate( 2014,12,1);") driver.find_element_by_id("ctl00_ContentPlaceHolder1_txtTodate").click() a = driver.execute_script("return setCalendarControlDate( 2015,1,11);") driver.find_element_by_id("ctl00_ContentPlaceHolder1_btnSubmit").click() elem = driver.find_element_by_id("ctl00_ContentPlaceHolder1_lnkDownload")

谢谢