I'm trying to make a simple bot that based on some conditions redirects me to a new URL on the same tab and clicks a button automatically. I have everything working dandy but when I get redirected to this new tab my code disappears and everything is reset. The redirect is all on the same domain. By the way I'm putting this code into the console in Chrome if that helps anything.

```
var a = URL
window.location.replace(a) //Redirects to a given URL and clears the console
$("input[type='submit']").click() //Doesn't get executed due to console being cleared

```

If there is no "clear cut" way to do this is there anyway I can work around this? If you need anymore information I'll be happy to provide it.

Edit: I tried using iframe to solve this but just threw an error which based off some google searches can't be solved.

Refused to display 'www.tacos.com' in a frame because it set 'X-Frame-Options' to 'DENY'.

Thank you in advance.