I have a question. I have the following code to wait for these elements and assign them those values. The problem is that the page is in loop thanks to the change event. I would like to know how to stop the timeout after having found those elements. Thanks!
function waitForElementToDisplay(selector, time) {
if (document.getElementById(selector) != null) {
document.getElementById(selector).value = "BM";
document.getElementById(selector).dispatchEvent(new Event('change'));
return;
}
else {
setTimeout(function () {
waitForElementToDisplay(selector, time);
}, time);
}
}
waitForElementToDisplay('form1:layoutPanel1:layoutPanel2:tabSetDirecciones:tabDirPrincipal:layoutPanelDirPrincipal:drpDirTipo_list',100);
waitForElementToDisplay('form1:layoutPanel1:layoutPanel2:tabSetDirecciones:tabDirPrincipal:layoutPanelDirPrincipal:txtDirBarrioCK_field',100);