I want to add debug function to the page that allows me to click N times given element as one liner JS console call. I have following short script:
// ==UserScript==
// @name Click given button N times
// @version 1
// ==/UserScript==
console.log("allright im here");
unsafeWindow.clickMe=function(target,n){
if(!n){
n=10;
}
for(var i=0;i<n;i++){
target.click();
}
}
unsafeWindow.test="blelbleb";
console.log(unsafeWindow.clickMe);
but when I try to to invoke that from the page (console) i get this
Why is that? How can I access exported function?
Moreover, clickMe
is printed out as Restricted
How to deal with that ?