node-horseman icon indicating copy to clipboard operation
node-horseman copied to clipboard

Update horsemanjs.org examples

Open awlayton opened this issue 9 years ago • 10 comments

The examples are outdated. Also, the API now allows chaining a .close, which the examples don't do (though .close still works the old way too).

The examples not working was pointed out in #127.

awlayton avatar Feb 22 '16 15:02 awlayton

I was trying to run the example for Google, to see how it goes, but I got this:

Unhandled rejection click
evaluatePage

global code
evaluateJavaScript@[native code]
evaluate@phantomjs://platform/webpage.js:390:39
phantomjs://code/bridge.js:121:61
    at /home/user/Desktop/googling/node_modules/node-horseman/lib/actions.js:989:36
    at tryCatcher (/home/user/Desktop/googling/node_modules/node-horseman/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.fromNode.Promise.fromCallback (/home/user/Desktop/googling/node_modules/node-horseman/node_modules/bluebird/js/release/promise.js:176:30)
    at Horseman.<anonymous> (/home/user/Desktop/googling/node_modules/node-horseman/lib/actions.js:987:29)
    at Horseman.tryCatcher (/home/user/Desktop/googling/node_modules/node-horseman/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/user/Desktop/googling/node_modules/node-horseman/node_modules/bluebird/js/release/promise.js:502:31)
    at Promise._settlePromise (/home/user/Desktop/googling/node_modules/node-horseman/node_modules/bluebird/js/release/promise.js:559:18)
    at Promise._settlePromiseCtx (/home/user/Desktop/googling/node_modules/node-horseman/node_modules/bluebird/js/release/promise.js:596:10)
    at Async._drainQueue (/home/user/Desktop/googling/node_modules/node-horseman/node_modules/bluebird/js/release/async.js:143:12)
    at Async._drainQueues (/home/user/Desktop/googling/node_modules/node-horseman/node_modules/bluebird/js/release/async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/user/Desktop/googling/node_modules/node-horseman/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
`

So, I think the example code for the Google needs an update. The Twitter one worked, but I took the code from @awlayton in the issue pointed above... Thanks in Advance :+1:

talysl avatar Apr 27 '16 13:04 talysl

Yeah all the examples are out of date I think @talysl. Of course even if they get updated, they'll eventually break again...

awlayton avatar Apr 27 '16 15:04 awlayton

Of course even if they get updated, they'll eventually break again...

@awlayton that's our job as a community/open source project though. I just started playing with horseman again after 6 months out and was trying to run through the readme and hit this bug.

I vote someone either updates it or removes it entirely because it makes the project appear abandoned when the first steps of the doc are broken

framerate avatar May 10 '16 19:05 framerate

The reason I haven't updated it is because I do not have access to change the website @framerate. That is why I assigned this issue to the only person I know of who can.

I was simply making a comment, not saying they should not be fixed.

awlayton avatar May 10 '16 19:05 awlayton

Ahh bummer on the website. I was referring to the README.md myself.

Also FYI the twitter examples is now broken too. Looks like mobile twitter switched to ReactJS

framerate avatar May 10 '16 19:05 framerate

It would be great to fix the Readme too. I am rather busy right now, but if you submitted a PR to fix them that would be great.

awlayton avatar May 10 '16 19:05 awlayton

but if you submitted a PR to fix them that would be great.

Done.

PR #178

I also converted the example to ES6, which I hope is alright. I feel it makes the project seem more "up to date". I can also convert the examples in the future if you'd like.

framerate avatar May 10 '16 20:05 framerate

I guess ES6 is fine. Sometimes arrow functions aren't nice since the this in the Promise callbacks is the horseman instance if you use regular functions.

awlayton avatar May 10 '16 20:05 awlayton

Cool, did that.

Also I see you're at Purdue. I went to IU. Hopefully that matters as little to you as it does to me and we can still be friends :)

framerate avatar May 10 '16 21:05 framerate

I updated the readme with a new working Twitter if that's the one you're trying! The old one was scraping their mobile site which changed to react so the selectors were broken. On May 11, 2016 3:49 AM, "Talita Silva Lima" [email protected] wrote:

Also FYI the twitter examples is now broken too. Looks like mobile twitter switched to ReactJS

@framerate https://github.com/framerate I don't know if you're talking about your project, but the twitter example is working here, do you want to have a look?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/johntitus/node-horseman/issues/128#issuecomment-218425160

framerate avatar May 11 '16 21:05 framerate