johntitus / node-horseman

Run PhantomJS from Node
MIT License
1.45k stars 124 forks source link

Update horsemanjs.org examples #128

Open awlayton opened 8 years ago

awlayton commented 8 years ago

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.

talysl commented 8 years ago

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:

awlayton commented 8 years ago

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

framerate commented 8 years ago

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

awlayton commented 8 years ago

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.

framerate commented 8 years ago

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

awlayton commented 8 years ago

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.

framerate commented 8 years ago

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.

awlayton commented 8 years ago

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.

framerate commented 8 years ago

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 commented 8 years ago

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" notifications@github.com 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