0

I'm testing the chrome extension "Kantu browser automation" and could use some help in figuring out how to select from a drop down list, when the drop down list is created based upon typed characters.

The website I'm testing on is https://uddannelsesstatistik.dk/Pages/dagtilbud_institutioner.aspx I've tried to record my way through with no success. I've tried to use click, but can't select the dropdown-list, since it disappears when attempting to clicking on it. I've tried ClickAt with Coordinates 262,504 and other coordinates as well. Nothing happens.

{
  "Name": "Uddannelsesstatistik - Dagtilbud",
  "CreationDate": "2019-2-11",
  "Commands": [
{
  "Command": "open",
  "Target": "https://uddannelsesstatistik.dk/Pages/dagtilbud_institutioner.aspx",
  "Value": ""
},
{
  "Command": "type",
  "Target": "id=dawa-autocomplete-input",
  "Value": "Aabakken 1, Rebæk, 6000 Kolding"
},
{
  "Command": "clickAt",
  "Target": "id=dawa-autocomplete-input",
  "Value": "262,504"
}
]
}

Right now, it stops when the characters is typed.

The expected output would be that i typed in e.g. "Aabakken 1" and then select the first entry in drop down list "Aabakken 1, Rebæk, 6000 Kolding".

I'm not that experienced in reading html code and how to specify to select first element in a html list, so i could really use all the references, examples, and all help in general.

desa
  • 48
  • 8
  • Hi @desa, which programming language are you using here? – Ali Feb 11 '19 at 11:05
  • Hey @AliCSE ! I'm using the Kantu browser automation IDE / Chrome extension. So I'm actually only clicking my way through the options without typing any code. However, the [Target] and [Value] fields in the IDE does allow for writing, but not in any specific programming language i think. The IDE have the possibility to export/import Json files and the code above is coming from that function. – desa Feb 11 '19 at 11:15
  • sorry, my bad. Never used kantu before but through script the provided xpath is working. Can you check and let me know if its helpful or not? Thank you... – Ali Feb 11 '19 at 11:15

1 Answers1

1

I have never used kantu before, but you can use the below xpath to identify the first element of the auto completion drop down and you can click on it.

//input[@id='dawa-autocomplete-input']/preceding::label/following::div[1]/ul/li[1]

Give some(at least 3 seconds) delay before performing click action using the above xpath otherwise you will get an error.

I hope it helps...

Ali
  • 1,689
  • 1
  • 5
  • 12
  • This took me a little bit further, but i still encounter some troubles. The first: The drop down menu does not show at all, no matter the pause and clicks i put in. This makes me wonder if Kantu is the right tool for the job. The second: When I manually click on the browser, so it is active, the dropdown menu shows and all the tasks are completed, so I'm guessing that the xpath is correct. However, it does not 'click', 'clickAt', or 'select' the option. – desa Feb 11 '19 at 11:50
  • Your answer works with the Selenium IDE! So I'm guessing there is some problems with the Kantu extension for Chrome. – desa Feb 11 '19 at 12:00
  • Ok, thanks for cross checking. I have already tested my answer before posting it, so it should work. – Ali Feb 11 '19 at 12:06