You can use the Scriptable app to run arbitrary JavaScript via an automation without user interaction. As an example, I use this to test if I have functional internet when I leave my house: if I forget to top up my mobile plan, I’ll hear a voice say, “you are not online.”