views:

407

answers:

2

Hi,

I'm looking for a way to write a non-GUI bot using Mozilla Framework. The bot should be able to work like normal browser (automatically download relevant JS files, make XMLHTTPRequests, run JS operations, modify DOM), except no GUI will be needed.

I wonder if it is possbile to build XULRunner without X, GTK/KDE (without any GUI dependencies), as I will run the bot on FreeBSD server 6.4.

It may sound a bit weird but I need a bot with capacity to operate like browser, runs JS, modifies DOM, submit forms running on non-GUI environments.

I've looked into other browsers such as Lynx, Links, Hulahop, Chrome V8 engine, WebKit JavascriptCore but yet to find desirable output.

It's a part of school project, thesis. We will use to observe price change of budget airlines and after one year long data collection, we need to deduce pricing strategy and customer behavior. It is a serious Final Year Project.

Any hint or help is greatly appreciated! Thank you in advance!

Regards.

+1  A: 
  1. Yes, it is possible (but it might very well require LOTS of code changes).

  2. No, I do not know any of the details.

  3. I would not recommend this approach for your purposes. From your comment, it sounds like you are trying to scrape webpages. If you really need to use JavaScript, you can use a stand-alone JavaScript-engine (Mozilla's is available here). Otherwise, I would use Beautiful Soup with Python or Twill. You might also want to read this question.

Rasmus Faber
Hi Rasmus,Thank you for reply. I'm looking for change in build options only and avoid any change to source code. We need to build the application on the top of the Mozilla Framework and will remain faithful with official source code to make our application maintainable.
Viet
We do need to use Javavascript and DOM engines and Network libraries altogether to collect data. JS engine alone won't do the work as DOM modification is requested by those websites. Thank you for suggestions.
Viet
+3  A: 

You should be able to make progress with selenium. It's a record/test/play tool but its core is manipulating the DOM.

Update from Grundlefleck's comment: As for launching the actual tests there is selenium remote-control, which allows you to write your tests in Java, Ruby, plain HTML and other possible drivers.

Robert Munteanu
Thank you, Robert! I'll try that out.
Viet
+1 for Selenium. It also allows you to write tests (which would be the OP's bot script) in many different forms, including HTML, Java and Ruby.
Grundlefleck
Thanks Grundlefleck for making the note.
Viet