Why this doesn't work?
Changing location
will reload the page and terminate all scripts including yours.
Basically you need to combine two scripts: one will redirect, the other one will do something in the redirected page.
if (location.pathname.startsWith('/account/store')) {
document.getElementsByName("sbor")[0].click();
console.log('Eggs collected');
} else {
location.href = 'https://golden-farm.biz/account/store';
}
This is a simplified demo so adapt it to your needs accordingly.
Hi wOxxOm, Thanks for helping a newbie in scripts! And for the fast answer! Will try it!
Why this doesn't work?
Hi, I'm trying to do a script to navigate into a page, execute a function going to especific page and then click a button, I cannot make it work, I tried to use async functions to wait one finishes the other. Any clue? Thanks!