-3

We have a small group of guys who play the game below. We take these games and stream them on Twitch so we can watch them as a group live. We have gotten down the process of automatically opening the URL and streaming the games. However, to get the plays to show there is an OnClick function that we have to manually remote in each time and click. Is there a way we can open this webpage and simulate the click so they are turned on? If you click the link below, you'll see a yellow button called Plays. If you click it you'll see what we want to be able to turn on without manually having to do it.

http://glb2.warriorgeneral.com/game/replay/171542

Parab00n
  • 73
  • 1
  • 5
  • 1
    Welcome to StackOverflow! Please be sure to read our [ask] page to help you formulate a great question. You are much more likely to get a good answer from the community if you put some effort into your question. – blurfus Mar 27 '15 at 17:44

1 Answers1

0

This depends a lot on how you're automating the page opening.

Normally, you can simply call .click() on an element in JS. But since you want to click something on a page you don't control, it gets complicated.

If you're simply opening a new tab/window via Javascript, you won't be normally able to do this because of cross-domain JS protections. You can disable them which is not recommended--if you go this path, you'll want to load the page in an iframe and execute a callback on it: see this answer. The callback you'll want will look something like:

function(){ window.frames[0].document.getElementById('toggle_plays').click(); }

Knowing how you're doing the automation would help significantly on how to solve the problem within your limits.

Community
  • 1
  • 1
xathien
  • 792
  • 6
  • 10
  • We are using batch files on windows scheduler to open the pages up. – Parab00n Mar 28 '15 at 18:37
  • Check [this answer](http://superuser.com/a/836752) which should let you execute some arbitrary Javascript after loading a page. It should get you on the right track. – xathien Mar 28 '15 at 22:34