10.js处理日历控件(修改readonly属性)
2021-02-03 23:13
标签:key web drive https _id sel driver cut send 10.js处理日历控件(修改readonly属性) 标签:key web drive https _id sel driver cut send 原文地址:https://www.cnblogs.com/Tofuir-miss/p/13151643.htmlfrom selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get("https://www.12306.cn/index/")
time.sleep(5)
# 去掉元素的readonly属性
js = ‘document.getElementById("train_date").removeAttribute("readonly");‘
driver.execute_script(js)
# 清空输入框后输入值
driver.find_element_by_id("train_date").clear()
driver.find_element_by_id("train_date").send_keys("2020-6-6")
# 用js方法输入日期
# js_value = ‘document.getElementById("train_date").value=("2020-6-6");‘
# driver.execute_script(js_value)
上一篇:php简单日志写入函数
下一篇:HTML
文章标题:10.js处理日历控件(修改readonly属性)
文章链接:http://soscw.com/index.php/essay/50622.html