Click doesn't work in JS
Posted: Mon May 12, 2025 9:52 am
Can you tell me why the button click doesn't work in executeScript?
Here is an example
//****************************
func :=
function ckickElem() {
let sub = document.querySelectorAll(''[data-testid="trap-drawer"]'');
if(sub[0] != undefined) {
console.log(sub[0].childNodes[1]);
sub[0].childNodes[1].click();
}
}
ckickElem();
wbBrowser.ExecuteScript(func);
//************************
sub[0].childNodes[1] - exists
This is one example.
Everything is working fine through the developer's console
Here is an example
//****************************
func :=
function ckickElem() {
let sub = document.querySelectorAll(''[data-testid="trap-drawer"]'');
if(sub[0] != undefined) {
console.log(sub[0].childNodes[1]);
sub[0].childNodes[1].click();
}
}
ckickElem();
wbBrowser.ExecuteScript(func);
//************************
sub[0].childNodes[1] - exists
This is one example.
Everything is working fine through the developer's console