How to select any random value from a dropdown?

后端 未结 4 1177
迷失自我
迷失自我 2021-01-21 18:57

I am working on selenium using Java. In my application I want to select any random value from the dropdown. Please tell how is it possible?

4条回答
  •  难免孤独
    2021-01-21 19:23

    Well, first get the total number of items in the dropdown. Then generate a random number between 0 and dropdown items count. Then select that number as index to set your dropdown item

提交回复
热议问题