gpt4 book ai didi

selenium - Selenium webdriver上的SendKeys偶尔在Internet Explorer 10中以大写形式发送文本

转载 作者:行者123 更新时间:2023-12-01 03:52:05 26 4
gpt4 key购买 nike

selenium webdriver 上的 SendKeys 偶尔会在 Internet Explorer 10 中以大写形式发送文本 - 例如登录页面:

        var wait = WebDriverWaitObject();
wait.Until(d => this.driver.FindElement(By.Id("uid")));
this.driver.FindElement(By.Id("uid")).Clear();
this.driver.FindElement(By.Id("uid")).SendKeys(username);

这种情况仅在 IE 上偶尔发生,在其他浏览器上没有。发送 key 有错误吗?

最佳答案

如果它是一个错误,也不会感到惊讶。我建议将您的 IE 版本从 64 位 -> 32 位或反之更改以进行测试。

此外,如果您使用的是 10.0.11(2013 年 11 月 12 日),请尝试使用较旧的版本。例如,当我使用旧版本的 chrome 时,有时它会解决这类问题,直到 selenium 社区为该浏览器版本发送修复程序。

最后,如果您使用的是随机生成的用户名。在将用户名发送到 key 之前,请尝试在用户名上使用小写/小写方法。就像是

random_username = "John"
lowercase_username = random_username.lower()

然后注入(inject) lowercase_username进入你的 Selenium 代码
this.driver.FindElement(By.Id("uid")).SendKeys(lowercase_username)

关于selenium - Selenium webdriver上的SendKeys偶尔在Internet Explorer 10中以大写形式发送文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21437927/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com