Re: How do I extract JS and CSS links from a web page?

Stephen Cresswell <[email protected]> Thu, 12 Feb 2009 18:18:07 +0000
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
Hi Wolfgang,

What we did was to convert the HTML to a XML Document then navigate the XML,
extracting all the CSS & Links etc.
If I remember it wasn't quite straight forward to get the XML Document
though - depending on the version of httpunit we used it threw exceptions,
but I think these have been discussed in other posts to the user list.

Thanks for getting back to me,

Steve


2009/2/12 Wolfgang Fahl <[email protected]>

>   Dear Stephen,
>   *
> *
>   thank you for your mail. I'm sorry for not getting back to you any
> sooner. Orignally i had intended to look into the details of this and give a
> response to you. Since I wasn't able to do this i'm wondering how you made
> progress in the meantime, what responses you got (if any) and whether others
> would like to get this issue solved.
>
>    Yours
>     W*olfgang*
>   >
>   > Hi,
>   >
>   > I'm hoping to use HttpUnit to check our application sets response
>   > headers appropriately (especially for caching). To do this I expect to
>   >
>   > 1. Issue a GET request for http://myapp.com/index.html
>   > 2. Interrogate the WebResponse to extract links to images, css and
>   > javascript
>   > 3. Issue GET requests for each image, css + js file
>   > 4. Re-issue the GET request and assert the response code is 304, and
>   > approprate expires / last modified headers are set.
>   >
>   > However I'm having problems obtaining the css and js urls.
> WebResponse.
>   > getExternalStyleSheet() only returns the first declaired stylesheet,
> and
>   > I haven't jet found a way to extract links to scripts.
>   >
>   > Any help appreciated,
>   >
>   > Thanks,
>   >
>   > Steve
>   *
> *
>   *
> *
>   *
> *
>   *BITPlan* - smart solutions
>   Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
>   Tel. +49 2154 811-480, Fax +49 2154 811-481
>   Web: http://www.bitplan.de
>   bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548,
> Geschäftsführer: Wolfgang Fahl
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Httpunit-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>
>

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop