Reputation: 9
I am trying to click a button on a page in Google Chrome using document.querySelector
and I used the inspect tool to find the exact path of the button in JS. This is what I tried:
window.deactivate = function() {
document.querySelector("JS path of the button").click();
}
However, this code didn't seem to work as the button wasn't clicked. I know for a fact that there is no issue with the actual function being called because there are other things that are working fine which are in the same function.
Upvotes: 0
Views: 294
Reputation: 5205
You just declared a function here.
Now you need to call it, like that:
window.deactivate();
Upvotes: 1