-   Linux - Software (
-   -   Is there a browser command line tool for testing javascript websites? (

MensaWater 09-01-2005 03:10 PM

Is there a browser command line tool for testing javascript websites?
Currently we are using Nagios to do systems monitoring. One of the monitor scripts we have uses the Lynx text browser to do a dump of a web site. We check the output of the dump to verify the web site is up and running properly. We don't actually wish to view the site - we are just doing this so that we can alert if it doesn't give expected results.

Recently we've had an issue a couple of times with a site not being monitored so wanted to add monitoring for it. Unfortunately this site uses Javascript and Lynx being a text only browser won't work on it. In researching this I did find a Lynx replacement called Links but couldn't find any info on whether it allows doing a command line dump like Lynx does. My fear is that it actually requires one to open a browser window which as noted we don't need or want.

Additionally what I really need to test is whether the login at the web site is working. That is to say I not only want to access the site but also do an automatic login with password to verify that works. It is the login that failed in the recent incidents.

I've done some searching for this but didn't really find anything.

Does anyone know if Links or any other open source browser allows for doing such command line dump and/or automatic login?

bigrigdriver 09-02-2005 07:41 PM

You can find Links here .

MensaWater 09-04-2005 10:12 AM

Thanks but one might suppose that the fact that I mentioned I had discovered "Links" would indicate I knew how to browse the internet. Or perhaps my comment that "I've searched but haven't found anything". My question was not where to find Links.

It was very specific about a need to access Javascript. While I suppose I could download it an try it my question was to see if anyone knew whether it worked for my sepcific need. For things like wget and curl there are specific FAQs that say they don't. If it doesn't work for this need then there is no point downloading it.

Of course one might say "RTFM" but since it only one of dozens of browsers that might or might not do what I want it seemed it was a perfect candidate for this list.

Sorry for the tone but it does annoy me when people don't actually read the detail that the FAQ here clearly indicates one should provide.

XavierP 09-04-2005 12:12 PM is a link to a site which has an experimental extension for the text browser - W3M. None of the text browsers seem to want to even know about javascript natively.

MensaWater 09-05-2005 03:49 PM

Quote from the Sourceforge link for WM3:

w3m is a pager and/or text-based browser. It can handle table, cookies, authentication, and almost everything except JavaScript.

XavierP 09-05-2005 04:51 PM

Quote from the page I linked to:

EXPERIMENTAL JavaScript support of w3m (w3m-js)
This is the EXPERIMENTAL patch for w3m to support JavaScript using NJS JavaScript Interpreter.

david_ross 09-05-2005 04:55 PM

If you want to test the login then you should be able to just send a get or post request with the username and password data, this won't test the javascript but it will test the server. Since the javascript is unlikely to change and pose a problem I guess it should be enough for you.

MensaWater 09-06-2005 09:46 AM

Thanks I'll have a look at it.

The user/password login screen is created by the Javascript so far as I can tell. When I view the source for the page there is no html code for these boxes. Using curl I was able to get the same page info but unable to login. My assumption is that it is ignoring the post data because it (the page) isn't requesting it but rather the javascript is waiting for it.

I'll admit I don't know much about web stuff so maybe I'm misunderstanding something. However all the suggestions I've found in my googling etc... don't seem to help. As a matter of fact most of the threads I've found show what people were trying to do to solve similar problems but never show an actual resolution.

Specifically I'm attempting to actually do the login because it is this login that lets the users know the application isn't working. The usual reason is because the DB on aother host was restarted AFTER the JBOSS on the host that has the web page. The fix is simply to stop/start JBOSS so it reconnects to the DB. The monitor I'm trying to write is one that would let me attempt the login. If it fails I would notify the folks who own JBOSS app (web page) to do their stop/start. Without this monitor the first indication we have of a problem is when the CIO himself attempts to use the app.

I'm working on another monitor instead that will simply let me know if JBOSS has started BEFORE the DB and alert but would really like to be able to test the login itself.

If there is a way of passing POST data to the Javascript using the exsiting tools please let me know. As noted above none of the methods I've seen tried in various threads actually seem to work when I try them.

theYinYeti 09-06-2005 09:53 AM

This heavily advanced "links" version does know about javascript:
(and can dump a web page)


david_ross 09-06-2005 12:22 PM

It shouldn't really matter how the form is made up. If it is using the http protocol then it will either send a GET or more likely a POST request to the server. You can then use lynx to make an identical request.

If you run ethereal and try to login you'll be able to see what type of request and in what format it is sent.

All times are GMT -5. The time now is 07:05 PM.