WatiN pressTab 不按 Tab

发布于 2024-08-08 01:29:23 字数 54 浏览 2 评论 0原文

有没有人找到了在 Internet Explorer 中使用 watiN 按 Tab 的方法?

Has anyone found a means to press tab with watiN in Internet explorer?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

南城旧梦 2024-08-15 01:29:23

您的意思是要按 Tab 键本身,还是只是单击看起来像 Tab 的 HTML 元素?对于后者,请对适当的元素(Div、Span 等)使用 Click 方法。否则,您可以尝试 SendKeys 而不是 PressTab。例如:

IE ie = new IE("http://www.google.com");
ie.AutoClose = false;
ie.TextField(Find.ByName("q")).Click();
SendKeys.SendWait("{TAB}");

上面的示例将设置文本字段的焦点,然后关闭 Tab,将焦点放在搜索按钮上。

Do you mean you want to press the tab key itself, or just click on an HTML element that looks like a tab? For the latter use the Click method against the appropriate element (Div, Span etc). Otherwise you could try SendKeys instead of PressTab. e.g.:

IE ie = new IE("http://www.google.com");
ie.AutoClose = false;
ie.TextField(Find.ByName("q")).Click();
SendKeys.SendWait("{TAB}");

The above example will set the focus the text field then tab off, putting focus on the search button.

阳光下的泡沫是彩色的 2024-08-15 01:29:23

我们遇到了同样的问题,我们解决它的重点是浏览器并使用 SendMessage (Win) 到特定的 hwnd。

we had the same problem, we resolve it focusin on the browser and using SendMessage (Win) to the specific hwnd.

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