javascript - TestCafe - Windows 10 上的 Internet Explorer 11 输入文本问题
问题描述
我的 testcafe 测试使用 Internet Explorer 将文本输入到文本字段中,但是当它输入文本时,它会删除所有其他字母。
例如:test@something.com
将输入为ts@oehn.cm
await t.typeText(Selector('#email'), 'myemail@email.com')
await t.typeText(Selector('#password'), 'mypassword')
await t.click(Selector('.account-form__button'))
await t.wait(6000);
这是有人见过的吗?相同的测试在 Windows 上的 Firefox 和 chrome 中运行良好。
解决方案
此问题可能与键入速度和附加到输入字段的事件处理程序有关:这些事件处理程序的执行速度比输入 keyup/keydown 频率慢。解决方法是像真实用户一样输入文本(即逐个字母):
const selector = Selector('#email');
const letters = [...'myemail@email.com'];
let index = -1;
for (const letter of letters) {
index += 1;
if (index === 0) {
await t.typeText(selector, letter, {replace: true});
continue;
}
await t
.wait(100)
.typeText(selector, letter);
}
推荐阅读
- amazon-dynamodb - 如何在 dynamodb 中为时间序列数据设置有效的模式,在哪里检索始终最新的变量
- c - 如何为具有原始名称的库函数创建包装器?
- oauth-2.0 - 负载测试 OAuth2 授权代码授予(使用 JMeter)
- spring - struts2 + SPRING MVC + Rest Api 集成。支柱不工作
- r - 如何在一行中连接数据框元素
- python - 在 matplotlib 的 for 循环中为子图添加唯一标题
- mysql - 使用 split 函数加速 Mysql 查询
- android - 在谷歌地图上绘制方向不是连续的
- java - ClientSocket 不听
- r - 如何使用 R 中的 auto.arima 生成带有日期的未来预测?