Selenium 或 WatiN 是否具有像 QTP 的Setting.WebPackage(“ReplayType”) = 2 这样的属性?
我正在测试的应用程序中有一些按钮和菜单需要实际单击才能发送所有信息,而 FireEvent 样式单击似乎并不能解决问题。 TestPartner 和 QTP 都可以使用实际点击。 TestPartner 总是(慢)执行此操作,而 QTP 通过将“ReplayType”从 1 更改为 2 来执行此操作。
Setting.WebPackage("ReplayType") = 2
所以我的问题是。有没有办法在 WatiN 或 Selenium 中获得真正的点击次数?我一直无法找到该选项。
谢谢你, 乔什
There are some buttons and menus in the application I am testing that require actual clicks to send all the information through and FireEvent style clicking does not seem to cut it. Both TestPartner and QTP can use actual clicks. TestPartner does this always (slow) and QTP does this by changing the 'ReplayType' to 2 from 1.
Setting.WebPackage("ReplayType") = 2
So my question is. Is there anyway to get real clicks in WatiN or Selenium? I have not been able to find that option.
Thank You,
Josh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Selenium 2 可以触发真实的点击,而不是像 Selenium 1 那样尝试合成点击和击键。它与操作系统进行了大量交互来本地执行这些操作,这解决了许多 Selenium 1 问题,例如它是否触发了单击或 mouseup 或 mousedown?
硒 2 处于第二 α 相,目前相当稳定。您可以从 http://code.google.com/p/selenium 获取 Selenium 2.0a2 /下载/列表。
我一直在研究 .NET 绑定,并且对它们的进展非常满意。
Selenium 2 can fire real clicks instead of trying to synthesize the clicks and keystrokes like Selenium 1 does. It does a lot of interaction with the OS to do these things natively which over comes a lot of the Selenium 1 issues like is it firing a click or mouseup or mousedown?
Selenium 2 is in its 2nd alpha phase and is quite stable at the moment. You can get Selenium 2.0a2 from http://code.google.com/p/selenium/downloads/list.
I have been working on the .NET bindings and am really happy with the way they are going.
当
ReplayType
设置为device(2)时,QTP实际上移动鼠标并执行单击(您可以看到鼠标光标移动)。我对 Selenium 不太熟悉,但据我所知,重播是在纯 JavaScript 中完成的,因此它可以触发 DOM 事件(就像 QTP 在事件ReplayMode
中所做的那样),但它不能模拟 真正的点击就像QTP那样。When
ReplayType
is set to device (2), QTP actually moves the mouse and performs a click (you can see the mouse cursor move). I'm not very familiar with Selenium but from what I know replay is done in pure JavaScript therefore it can fire DOM events (as QTP does in eventReplayMode
) but it can't simulate a real click the way QTP does.使用 WatiN,可以访问 IE 窗口中元素的“本机”界面。使用它您可以获取任何元素的屏幕坐标。
要使用它:
显然该元素必须是可见的。我不知道如何立即检查这一点,但我认为您可以更改正文的scrollTop 和scrollLeft 属性以进行滚动。
您还需要一种方法来实际执行点击,但 stackoverflow 上可能已经有答案。
With WatiN, it is possible to get to the "native" interface of elements in IE windows. Using that you can get the screen coordinates of any element.
To use it:
Obviously the element has to be visible. I don't know how to check for that offhand, but I think you can change the scrollTop and scrollLeft attributes of the body to scroll around.
You'll also need a method to actually do the click, but there's probably an answer for that already on stackoverflow.