0
Good morning. I have developed a script to run on a given web page, an action automation.
[...]
if (codigo == codigo1) {
processar(codigo2);
} else {
if (quantAldeias > 0) {
$('.groupRight').click();
var nextRun = confirm("Fazer?");
if (nextRun == true) {
processar(codigo1);
quantAldeias--;
};
}
}
[...]
My intention is for him to execute $('.groupRight'). click();, that triggers the exchange of the current page for another, and after opening the next page, run the rest of the block. What happens is that all the code is triggered, and nothing happens on the next page.
I tried to use:
setTimeout(function(){
$(document).ready(function() {
quantAldeias--;
processar(codigo1);
});
}, 3000);
and window.onload, but they didn’t work. They can help me?
Madson, I don’t get it. Do you do a full page Reload? Because if so, your script will not have scope on the new page. What you want would only work with ajax.
– Diego B. Sousa
my script changes the current page. So with js, when I change the page, is it impossible to keep a running script running? For I shoot it through Mozila’s scratchPad
– Madson Paulo
When you exchange the full page the previous javascript and all objects of the previous page are discarded. Try making a script with greasemonkey, it might work.
– Diego B. Sousa
Ah I understand, thank you very much :)
– Madson Paulo