WatiN 并输入大写字母
我正在尝试自动输入密码,但相关网站不允许您在打开大写锁定键的情况下输入密码。 WatiN 似乎使用大写锁定键来输入大写字母,因此不允许此操作。
有谁知道强制 WatiN 使用 Shift 键的解决方法或方法?
I'm trying to automate a password entry but the website in question does not allow you to type your password with the caps lock key on. WatiN appears to use the caps lock key in order to type capital letters thus not allow this to work.
Does anyone know a workaround or a way to force WatiN to use the shift key?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以像这样将自己的扩展写入 TextField 类...
然后使用
TypeTextFast
而不是TypeText
。在运行 WatiN 测试时,这将进一步显着提高打字速度(特别是在 IE 中)。请参阅此 了解更多详情。You could write your own extension to the TextField class like this...
and then use
TypeTextFast
instead ofTypeText
. This would furthermore improve typing speed considerably (particularly in IE) when running the WatiN test. See this for further details.TextField 类具有 Value 属性,您可以使用它直接设置 TextBox 的文本,而无需模仿手动输入,如 TypeText() 方法。
顺便说一句,因为该值是在场景后面设置的,所以它可能不会引发该值已更改的事件,如果您在键入时附加操作,则这可能是必要的。 TypeText() 正在为您处理这个问题。在这种情况下,您可以在设置值后使用 Change() 方法。
The TextField class has the Value property you can use to set text of the TextBox directly, without mimicking a manual input, like the TypeText() method.
As a side note, because the value is set behind the scene, it may not raise an event that the value has change, which could be necessary if action append as you type. The TypeText() was taking care of that for you. In those case you can use the Change() method after setting the Value.
自从我使用 WatiN 创建任何内容以来已经有一段时间了,但是您可以直接使用如下所示的内容分配文本:
TextBox.Text = "PaSsWoRd";
我使用上述方法登录网站没有任何问题。
It has been a while since I created anything with WatiN, but you can assign the text directly with something like this:
TextBox.Text = "PaSsWoRd";
I logged into a website without any problems using the above.