Hey,
Im want to click on list element that visible after typing utt but when i do with javascript its not clicking just typing utt one by one
but when i do with without js its working fine but only for 1 block there is multiple and i wanted for multiple not just for one:
My code with JS version:
{
"Name": "UK GOVT",
"CreationDate": "2024-12-6",
"Commands": [
{
"Command": "executeScript",
"Target": "var fields = document.querySelectorAll(\"input[placeholder='--- Select Other Entity ---']\"); function processFields(index) { if (index < fields.length) { var field = fields[index]; field.click(); setTimeout(function() { field.value = 'utt'; field.dispatchEvent(new Event('input', {bubbles: true})); setTimeout(function() { var dropdownItem = document.querySelector('.select2-results__option.select2-results__option--highlighted'); if (dropdownItem) { dropdownItem.click(); setTimeout(function() { processFields(index + 1); }, 500); } }, 500); }, 200); } } processFields(0);",
"Value": "",
"Description": "Clicks fields, types 'utt', selects Uttarakhand Government from dropdown"
}
]
}
Code without JS just for single field:
{
"Name": "UK GOVT",
"CreationDate": "2024-12-6",
"Commands": [
{
"Command": "store",
"Target": "--- Select Other Entity ---",
"Value": "placeholder"
},
{
"Command": "click",
"Target": "css=input[placeholder='${placeholder}']",
"Value": ""
},
{
"Command": "pause",
"Target": "500",
"Value": ""
},
{
"Command": "type",
"Target": "css=input[placeholder='${placeholder}']",
"Value": "utt"
},
{
"Command": "pause",
"Target": "1000",
"Value": ""
},
{
"Command": "click",
"Target": "css=.select2-results__option.select2-results__option--highlighted",
"Value": ""
}
]
}