I’m trying to create a script for a browser game I’m playing using the scripty extension for chrome with javascript.
When I simulate a button click, I’m pretty sure it’s bringing up a new page to submit the command.
`//selecting location
document.getElementsByClassName(“target-input-field target-input-autocomplete ui-autocomplete-input”)[0].value = “433|539”;
//sword count
document.getElementById(“unit_input_sword”).value = “2”;
//spear count
document.getElementById(“unit_input_spear”).value = “2”;
`
this works ^
the problem is after I simulate the target_attack click, it brings up a new page and I cant find the id. I was thinking I could use window.onload() for this but I just haven’t managed to get it to work, or an async await function, which again I can’t get to work.
The below code is the last of what I was trying to get work before I’ve now give up and ask for help.
`const submit = async function () {
return document.getElementById(“target_attack”).click();
};
submit().then(function() {
document.getElementById("troop_confirm_submit").click();
});
`
Apologies for the the bit of a mess, it’s my first time posting.
Expecting after the target_attack click is triggered, the troop_confirm_submit get’s triggered right after.