I have a greasemonkey script to run in a specific website.
The objective is make click in a specific button,
remove the cookie (Tthe website sets the cookie on click, i have to remove the cookie before to make the new click, but the trouble is the cookie is not sets with jquery click
)
then reload the page.
And repeat the process.
But, jquery click method don’t sets the cookie but the human click yes
here is the code:
// ==UserScript==
// @name name
// @namespace someName
// @include http://www.example.com/*
// @version 0.1
// @grant all
// @require http://code.jquery.com/jquery-1.8.2.min.js
// ==/UserScript==
function del_cookie(name) {
document.cookie = name +
'=; expires=Thu, 01-Jan-70 00:00:01 GMT;path=/;';
}
function fnc(){
try{
$("#elemenID").click();
del_cookie("elemID");
location.reload();
}catch(e){
alert(e.toString());
}
}
$(document).ready(function(){
window.setTimeout(fnc, 10000);
})
I have solved this, and the problem was the time factor.
here is the final greasemonkey script.