Headless Web Browser During Cron?

Events happening in the community are now at Drupal community events on www.drupal.org.
jbeuckm's picture

I tried to post this to Drupal Answers but it was shut down. Still, I think it's an interesting question. Maybe one of you locals knows the answer or would be kind enough to vote the question re-opened?

http://drupal.stackexchange.com/questions/47777/headless-web-browser-dur...

Comments

What is the use case?

zzolo's picture

Hey @jbeuckm. I am curious why you need this? That would help inform the answer some more.

--
zzolo

Question Reopened!

jbeuckm's picture

Thanks to those who may have nominated my question for reopening. I do think the stackexchange site is extremely useful and understand that they are eager to keep it clean.

zolo,
I have a system to process DOMs that is and will continue to be written in jQuery. It's not computationally expensive, but too logically complex to keep porting to PHP/xPath. I can't control the DOMs and I need some render-specific info like element position and form factor.

Interesting. Well,

zzolo's picture

Interesting. Well, SimpleTest is not a browser; it mostly just fakes a DOM; and won't process javascript.

I am still confused on what you are actually trying to do. Finding an elements position on the server side seems quite odd.

It sounds like you are actually looking to run a browser, otherwise I would suggest writing some scripts in Node.js that use your jQuery to do whatever it is you are trying to accomplish.

Running a headless browser is a huge pain in the ass, and I would really suggest rethinking what you are trying to accomplish. Really the only reason it is needed is for automated testing. Selenium is the most widely used solution but it is difficult to get set up correctly.

There are some newer things like Phantom.js and Zombie.js, but I am not sure if these are really what you need. Phantom.js uses webkit but still not sure if its going to server your needs.
http://phantomjs.org/
http://zombie.labnotes.org/

--
zzolo

Simpletest not processing JS

jbeuckm's picture

Simpletest not processing JS is what I needed to know. I was looking at Simpletest because it's already sitting there for the testing framework. Phantom sounds like a good option since a webkit-based browser is likely to represent what the average user sees.

Twin Cities

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: