python - 如何使用 Selenium 和 Python 更新 AngularJs 输入标记值?
问题描述
目标输入元素:
input ng-required="$ctrl.isRequired" name="" moment-picker="$ctrl.selectedFormattedDate" ng-model="$ctrl.selectedMoment" value="Fri Mar 27 2020 00:00:00 GMT+0530" ng-disabled="$ctrl.disabled" class="mw-date-picker mw-date-picker-dropdown ng-pristine ng-valid moment-picker-input md-input ng-not-empty ng-valid-required ng-valid-min-date ng-valid-max-date ng-touched" format="L" locale="en" min-view="year" max-view="month" start-view="month" timezone="$ctrl.timezone" today="$ctrl.isTodayHighlighted" change="$ctrl.handleDateChange(newValue, oldValue)" min-date="$ctrl.minDate" max-date="$ctrl.maxDate" tabindex="0" id="input_198" required="required" aria-invalid="false" style="">
我尝试使用 Python 代码更改属性“值”:
driver.execute_script("arguments[0].value = '03/10/2019';", element)
此命令会更新前端的值,但单击确定后不会保存更改(确定按钮单击代码没有问题)。我也尝试更改“moment-picker”,但它也没有帮助。有人可以帮我解决使用 Python 的方法吗?
解决方案
推荐阅读
- c++ - OpenDDS 入门 - 创建在设备之间传输数据的文件
- multidimensional-array - 如何用ndarray将矩阵乘以视图?
- javascript - 如何从所有键都相同的数组中提取对象
- node.js - 无法从客户端上传文件到 nextcloud
- opencv - mingw32-make install "multiple target patterns" 安装opencv时出错
- excel - 我可以在函数中使用运算符进行查找/替换吗
- javascript - 评估设置“学习大师”时出现问题
- swift - “无法生成表达式诊断;请提交错误报告”预览 xcode 12.4
- javascript - 从 ImageCollection 生成单个图像,该图像将具有 NDVI 具有最大值的一年中的一天的像素值
- linux - 带有 gnome 网络管理器的 wlan 热点在 auth 中循环