python - Selenium - 键盘python无法访问
问题描述
birthday = driver.find_element_by_name("date_of_birth_day")
birthday.send_keys("11092000")
birthday.send_keys(Keys.RETURN)
当我运行此代码时,我得到
"input class=" web-date-input__form-input" name="date_of_birth_day" type="number"> is not
reachable by keyboard"
但元素是“Keyboard-Focusable”
input class="web-date-input__form-input" type="number" placeholder="DD" autocomplete="off" maxlength="2" max="31" min="1" name="date_of_birth_day" tabindex="3" data-testid="input-birthday-day" value="11".
我不明白这个问题
解决方案
我找到了一种方法来解决它,只需发送没有元素的密钥,我不确定它是否会在任何情况下工作,但它对我有用。
import actions = ActionChains(driver)
actions.send_keys("11092000")
actions.send_keys(Keys.RETURN)
actions.perform()
推荐阅读
- python - 如何解决一维数据拟合不佳的问题?
- node.js - 如何检索邮递员以快递方式发送的表单数据?
- python - 为什么 cv2.line 不能就地绘制 1 通道 numpy 数组切片?
- java - android.os.TransactionTooLargeException; 在选项卡之间滚动并打开新活动后数据包大小 N 字节
- javascript - 部署时 lightbox2 模态不显示图像的问题
- javascript - Html & JS 单击时将图像旋转 90 度
- ansible - Ansible:将文件从本地复制到远程-“AttributeError:'dict'对象没有属性'endswith'”
- python - Plotnine 中的“无法评估‘颜色’映射”错误
- image - 从像素数组构建图像 - Flutter
- swift - 我想从其他视图控制器(swift)中删除collectionview的单元格