问题
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
- Load the page
- Enter the value using typeAndWait to let the Ajax call happen
- 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