Forum Discussion

PingS's avatar
PingS
Occasional Contributor
7 years ago

How to open a dropdown control

I am writing Automation Test for a web appliocation. On a page, there are two controls: Date of Birth and Gender. The Date of Birth is like a Datetimepicker. When it is clicked, a calender shows up. ...
  • PingS's avatar
    PingS
    7 years ago

    I tried the recording the tests using keyword test but the Gender Dropdown does not open when the recording is on.

    After a few tries, I eventually found the solution. The DateTimePicker and the Generder Dropdown are wrapped inside a lot of control containers. The DateTimePicker control has two <Input> and they are inside multiple <div>, I must get the <input> with "class = 'dateTimePicker'" using XPath and then perform  click() operation on this control to open the DateTimePicker; the Gender DropDown has multiple <span> controls, I must get the <span> with "Role = 'combobox'". When perform a "Click ()" on this control, it opens the dropdown.

     

    The attached image has the two controls hightlighted in Red. I hope this may help someone who is puzzling on this type of issues.