硒光标聚焦在字段上

发布于 2024-11-14 23:07:52 字数 202 浏览 1 评论 0原文

我正在为网络应用程序创建测试(在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

2024-11-21 23:07:52

您可以使用 selenium2 AdvancedUserInteractions API

 Actions builder = new Actions(driver);
 builder.moveToElement(someElement).build().perform();

You can use selenium2 AdvancedUserInteractions API:

 Actions builder = new Actions(driver);
 builder.moveToElement(someElement).build().perform();
凝望流年 2024-11-21 23:07:52

如果我对你的问题的理解是正确的,你想为不同的元素显示不同的帮助屏幕,
好的,如果屏幕消息显示为工具提示并且样式由鼠标悬停事件处理
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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文