0

I have to test a web site, and I have wrote a tampermonkey script that surf randomly the site and change parameters, sometimes I need to change page and if I change page with window.location.replace(URL) or by pressing button with the script, for example document.getElementById('button_that_redirects').click() the script stop to works after the new page is loaded. How can I do to run a javascript script that allow to change page during the execution? Have I to use an other program instead tampermonkey?

Andrea993
  • 663
  • 1
  • 10
  • 23

1 Answers1

0

If you have redirections happening on the same domain, you could let your script create a cookie with all necessary state information, so that when the script gets launched on the redirected page, your script can detect the cookie, get the necessary context from it, and continue with whatever it needs to do. You could for instance include js_cookie for this.

An alternative to using cookies would be an html5 local database.

trincot
  • 317,000
  • 35
  • 244
  • 286