IWebElement.SendKeys() 不完整
我遇到的问题是 IWebElement.SendKeys() 没有填充我想要的整个输入字段。下面是代码示例:
...
IWebElement el1 = driver.FindElemenet(By.Id("el1Id"));
IWebElement el2 = driver.FindElemenet(By.Id("el2Id"));
el1.SendKeys("sometext");
el2.SendKeys("someothertext");
...
因此,有时,它不是用“sometext”填充 el1Id,而是用 el2Id 进行处理,而在 el1Id 中,它仅填充“somet”。大约 30% 的情况会发生这种情况,键入的字符数因情况而异。我使用的是火狐8.0
I'm experiencing the problem that IWebElement.SendKeys() does not fill entire input field that I'm aiming. Here is the code example:
...
IWebElement el1 = driver.FindElemenet(By.Id("el1Id"));
IWebElement el2 = driver.FindElemenet(By.Id("el2Id"));
el1.SendKeys("sometext");
el2.SendKeys("someothertext");
...
So, sometimes, instead of filling el1Id with "sometext", it proceeds with el2Id and in el1Id it is only filled "somet" for example. This is happening in like 30% of cases, number of typed characters differs from case to case. I'm using Firefox 8.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想更加稳健,只需在下一步之前添加等待即可。
类似:
或者
这样就可以了。
If you want to be more robust just add a waiting before the next step.
Something like:
or
That's will do the job.