Selenium - 验证建议列表是否显示

发布于 2024-09-17 20:03:19 字数 63 浏览 3 评论 0原文

在文本字段中输入字母时,使用什么命令来验证是否显示建议列表(例如:a)?如何验证列表中的项目以您输入的字母开头?

What command is used to verify the list of suggestions is displayed when typing a letter in text field (example: a)? And how to verify the items in the list start with the letter you typed?

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

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

发布评论

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

评论(1

攒一口袋星星 2024-09-24 20:03:19

我相信您正在谈论诸如带有自动完成功能的 Google 建议之类的内容。您的测试将如下所示

  1. 加载页面
  2. 使用 typeAndWait 输入值以让 Ajax 调用发生 将
  3. 结果与文本 blob 进行比较 调用

将如下所示

open(/)
typeAndWait(textId,a)
verifyText(css=div#suggestion:first-child,a*)

希望有帮助

I believe you're talking about something like Google Suggests with autocomplete. Your test would look something like this

  1. Load the page
  2. Enter the value using typeAndWait to let the Ajax call happen
  3. Compare the result to a text blob

The calls would be like this

open(/)
typeAndWait(textId,a)
verifyText(css=div#suggestion:first-child,a*)

Hope that helps

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