Saturday, 3 December 2016

my brain is melting trying to figure out how to use casperjs

My end goal is to make a program that will play an online game without any intervention from me.Here are the steps I want it to takeOpen the website's game page. If the user is not logged in, there will be a username/password form obviously. If not logged in, fill out the form, submit, and re-route to game page. If the user is logged in, the game page will show by default.Constantly scrape the state of the webpage looking for changes in the game to process.If the game is finished, search for a new game and repeat steps 2 and 3 indefinitelyI have been trying to do even the most basic things in casperjs and nothing is working as I'm expecting. I understand that like node, casperjs is asynchronous and functions are called when certain events happen. Is casperjs even the right tool for what I'm trying to do? It seems like what I need, but when I look at examples it seems like people mostly use it to just run down a list of things to do to a webpage and then quit, whereas I want it to open pages conditionally, re-route to pages conditionally, and stay active on certain pages processing events within the page forever.If this is possible to do with casperjs, then the problem is obviously with my understanding of asynchronous programming... I hate that I can't structure my code in an organized way. Whenever I work with node my projects always just become a confusing clusterfuck of nested callback spaghetti that I would feel embarrassed to show anyone.I would be super appreciative if someone with experience with this kind of thing could help me out via voice chat on skype or something, PM me please and save me from this nightmare

Submitted December 04, 2016 at 03:10AM by mattbrah

No comments:

Post a Comment