[英]python selenium does not click on element
I would like to click the calendar, but somehow it does not click (it is on the three bar left-hand side)我想单击日历,但不知何故它没有单击(它位于左侧的三栏)
driver.get('http://www.sse.com.cn/disclosure/bond/announcement/company/')
wait = WebDriverWait(driver, 50)
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='sse_searchInput']/input[@class='form-control sse_input']"))).click()
Many Thanks!非常感谢!
If you look at the element the inputBox is readonly
attribute that's the reason its not allowing any value to enter.如果您查看元素,inputBox 是
readonly
属性,这就是它不允许输入任何值的原因。
<input class="form-control sse_input" type="text" placeholder="开始时间 至 结束时间" readonly="" lay-key="1">
To make it available to enter the date you can removed the readonly
attribute from that element and then enter the date using send_keys
.要使其可用于输入日期,您可以从该元素中删除
readonly
属性,然后使用send_keys
输入日期。
driver.get('http://www.sse.com.cn/disclosure/bond/announcement/company/')
wait = WebDriverWait(driver, 20)
dateInputBox=wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='sse_searchInput']/input[@class='form-control sse_input']")))
driver.execute_script("arguments[0].removeAttribute('readonly')", dateInputBox)
time.sleep(1)
dateInputBox.send_keys("2022-03-31 - 2022-04-22")
print("Date added :" + dateInputBox.get_attribute("value"))
time.sleep(10) # testing purpose to view it
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.