硒光标聚焦在字段上
我正在为网络应用程序创建测试(在 Firefox 中)。
根据光标所在的字段,将会出现不同的帮助屏幕。但是,当为这些帮助屏幕创建测试时,我无法让 Selenium 专注于我想要的特定领域。 我尝试过使用 fireEvent、单击、选择和键入,以使焦点停留在我需要的字段上,以便加载特定的帮助屏幕,但我没有运气。
有谁知道如何解决这个问题。或者我该如何解决它?
I'm creating tests (in Firefox) for a web app.
Depending on what field the cursor is over, a different help screen will appear. But when creating tests for those help screens, i cant get Selenium to focus on the particular field i want.
I've tried using fireEvent, click, select, and type in order to get the focus to stay on the field i require in order to load that particular help screen but i've had no luck.
Does anyone have ideas on how this can be solved. Or how i can work around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 selenium2 AdvancedUserInteractions API:
You can use selenium2 AdvancedUserInteractions API:
如果我对你的问题的理解是正确的,你想为不同的元素显示不同的帮助屏幕,
好的,如果屏幕消息显示为工具提示并且样式由鼠标悬停事件处理
selenium.mouseOver(locator) 然后 [ Thread.sleep(1000) ] 然后使用
硒.mouseOut(定位器)
尝试这个。如果你不明白,如果我对你的问题的理解是错误的,请发布它。
您必须调查该屏幕的显示方式。并尝试发布所有代码
if my understanding of your question is correct, you wanted to display different help screens for differnt elements,
o.k here it is, if the message of the screen is displayed as a tool tip and the styling is taken care by mouseover event
selenium.mouseOver(locator) and then [ Thread.sleep(1000) ] and then use
selenium.mouseOut(locator)
try with this.if you don't get it and if my understanding of your question is wrong please post it.
you must investigate how that screen is being is displayed. and try to post all that code