Can selenium handle autocomplete?

前端 未结 17 1283
粉色の甜心
粉色の甜心 2020-12-09 04:26

I have a test case that requires typing in a partial value into an ajax based textfield and verifying the list has the expected content. If it does, select the content. An

17条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 05:11

    I'd do this as follows:

    • type to enter the value in the text field.
    • waitForTextPresent or verifyTextPresent to check the autocomplete content
    • click or mouseDown to click on the item in the autocomplete list

    The trick is going to be making the final click be just in the right place. You should be able to use an XPath expression that searches for the text you're expecting to find it.

提交回复
热议问题