Selenium - verify the list of suggestions is displayed

混江龙づ霸主 提交于 2020-01-13 17:56:24

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/3640677/selenium-verify-the-list-of-suggestions-is-displayed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!