Question
Accenture
IN
Last activity: 14 Mar 2019 13:59 EDT
Unable to select item from Combo box
Hi,
In an automation I need to use the google search page where I have to get the currency rates of different countries. Seems to be a simple problem but am unable to implement it.
Perhaps some raise events were used behind because using the method select item by text it is changing but the new value currency rate is not reflecting.
Hello Sarvan,
You can use following JS function to set the selected index. On my test, google page was able to recognize the selected Index.
//<htmlId> HtmlId of the Combobox
//<index> index you want selected of the combobox
function raiseChangeEvent(htmlId, index){
var target = document.getElementById(htmlId);
target.selectedIndex = index;
var ev2 = new Event('change', { bubbles: true});
target.dispatchEvent(ev2);
}
Thanks