3 ms·
Well, I was trying to avoid spoilers, but since jaredsohn has already sailed that boat out to sea... How do you script something like this? I tried looking at
by xiaoma 14y ago
Well, I was trying to avoid spoilers, but since jaredsohn has already sailed that boat out to sea...
How do you script something like this? I tried looking at the source and then using the chrome console to input jQuery commands, but something really weird happened. I could replace just about any element on the screen except the one that mattered!
I could type "challenge 8" into the console and then running a $('tester').text() would return "challenge 8" as expected. But $('tester').text('challenge 9') wouldn't update the screen. I tried for a good hour to find a way to update the text in that element, with no luck (short of removing the whole thing from the dom).
(see http://postimage.org/image/c3xkrg8y3/ http://postimage.org/image/c3xkrg8y3/ )
Also how do you send a carriage return? Inserting a newline didn't seem to do the trick. Anyone? As much as I love a challenge, beating my head against this one issue doesn't yield much education / time spent.
- jaredsohn 14y agoIf you look at the JavaScript, you can see that it actually expects a keystroke for the Enter key. I'm not familiar with sending keystrokes in JavaScript (from some brief searching I think it is possible; I just don't know the best practice), but for something like this, you could just do it at the operating system level. A long time ago I automated an annoying user interface for a program we had to use at work by writing some vbscript that changes windows and does a combination of sendkeys and sleep. Unfortunately, just sending keystrokes isn't very robust since it isn't reading what is going on in the UI and if something random happens (the site behaves other than expected, you touch a key / move the mouse, a scheduled program runs, etc) the script could get out of sync. Fortunately, the consequences of an error are so low here that such a solution would be good enough.