Parsing html strings

View: New views
11 Messages — Rating Filter:   Alert me  

Parsing html strings

by gurtus2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi group.
Users send requests to my webserver which sometimes contain html
documents. I use htmlunit in the same JVM that runs the webserver,
so in principle I can use it. Now I would like to know if and how I can
create a HtmlPage object from a String. Is that possible?
If not, can I somehow use methods in htmlunit which can remove all
html in a given string?
I could use simple regexps for that, but it may get complicated when
I receive non-html texts which contain angel brackets in which there are
no valid tags. So, a working parser like the one that ships with htmlunit
would be very nice.

Greetings,
Frank


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Parsing html strings

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Frank,

You could hack it by giving your WebClient instance a MockWebConnection configured appropriately. See the javadocs for more info.

Take care,

Daniel


On Wed, Oct 21, 2009 at 5:51 AM, <gurtus2@...> wrote:
Hi group.
Users send requests to my webserver which sometimes contain html
documents. I use htmlunit in the same JVM that runs the webserver,
so in principle I can use it. Now I would like to know if and how I can
create a HtmlPage object from a String. Is that possible?
If not, can I somehow use methods in htmlunit which can remove all
html in a given string?
I could use simple regexps for that, but it may get complicated when
I receive non-html texts which contain angel brackets in which there are
no valid tags. So, a working parser like the one that ships with htmlunit
would be very nice.

Greetings,
Frank


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user



--
Daniel Gredler
http://daniel.gredler.net/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Parent Message unknown Re: Parsing html strings

by gurtus2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Message

Great thanks, this works indeed!

Here a small Clojure function which demonstrates it:


(defn foo [#^String s]
  (let [wc   (WebClient.)
        mock (MockWebConnection.)
        url  (java.net.URL. "http://www.foo.bar/")]
    (.setResponse mock url s)
    (.setWebConnection wc mock)
    (.asText (.getPage wc url))))


This should handle most cases.

But do you see a way how to have htmlunit removing only

those angle brackets that contain valid html? Or maybe a

method that returns true/false which says that all angle

brackets in a document contain correct html only?

So if one input is:

"The man said <hello world> and then left the room" that

I would get back that same string instead of

"The man said and then left the room".

I think otherwise a simple regex that removes everything

between '<' and '>' would be more efficient.

 

 

 

-----Ursprüngliche Nachricht-----
Von: "Daniel Gredler" [djgredler@...]
Gesendet: Do. 22.10.09 (05:40)
An: htmlunit-user@...
Betreff: Re: [Htmlunit-user] Parsing html strings

Hi Frank,

You could hack it by giving your WebClient instance a MockWebConnection configured appropriately. See the javadocs for more info.
-----Ursprüngliche Nachricht Ende-----


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Parsing html strings

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Frank,

Regex might be best, or a lower-level use of NekoHtml itself. As is, there's no telling what Neko will do to fix up malformed HTML under the covers before giving it back to you via HtmlUnit.

Take care,

Daniel



On Thu, Oct 22, 2009 at 5:43 AM, <gurtus2@...> wrote:

Great thanks, this works indeed!

Here a small Clojure function which demonstrates it:


(defn foo [#^String s]
  (let [wc   (WebClient.)
        mock (MockWebConnection.)
        url  (java.net.URL. "http://www.foo.bar/")]
    (.setResponse mock url s)
    (.setWebConnection wc mock)
    (.asText (.getPage wc url))))


This should handle most cases.

But do you see a way how to have htmlunit removing only

those angle brackets that contain valid html? Or maybe a

method that returns true/false which says that all angle

brackets in a document contain correct html only?

So if one input is:

"The man said <hello world> and then left the room" that

I would get back that same string instead of

"The man said and then left the room".

I think otherwise a simple regex that removes everything

between '<' and '>' would be more efficient.

 

 

 

-----Ursprüngliche Nachricht-----
Von: "Daniel Gredler" [djgredler@...]
Gesendet: Do. 22.10.09 (05:40)
An: htmlunit-user@...
Betreff: Re: [Htmlunit-user] Parsing html strings

Hi Frank,

You could hack it by giving your WebClient instance a MockWebConnection configured appropriately. See the javadocs for more info.
-----Ursprüngliche Nachricht Ende-----


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Htmlunit and images

by Chad Bellan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Does htmlunit request images? 

                If yes, are there certain requirements for images to also be loaded when a webpage is opened (ie:  css on, JS on, etc…)? 

 

Chad

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Htmlunit and images

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Chad,

By default, HU only downloads images with onload event handlers. You can force image download though; see the HtmlImage javadocs for more info.

Take care,

Daniel



On Thu, Oct 22, 2009 at 1:12 PM, Chad Bellan <chad.bellan@...> wrote:

Does htmlunit request images? 

                If yes, are there certain requirements for images to also be loaded when a webpage is opened (ie:  css on, JS on, etc…)? 

 

Chad

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Htmlunit and images

by Chad Bellan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

If you mean the url: http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/html/HtmlImage.html

 

I don't see an option to force the download of images.  Can you help me further with this?

 

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 

From: Daniel Gredler [mailto:djgredler@...]
Sent: Thursday, October 22, 2009 4:58 PM
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Htmlunit and images

 

Hi Chad,

By default, HU only downloads images with onload event handlers. You can force image download though; see the HtmlImage javadocs for more info.

Take care,

Daniel


On Thu, Oct 22, 2009 at 1:12 PM, Chad Bellan <chad.bellan@...> wrote:

Does htmlunit request images? 

                If yes, are there certain requirements for images to also be loaded when a webpage is opened (ie:  css on, JS on, etc…)? 

 

Chad

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Htmlunit and images

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Chad,

All of the methods marked "POTENIAL PERFORMANCE KILLER - DOWNLOADS THE IMAGE - USE AT YOUR OWN RISK" trigger the download.

Take care,

Daniel



On Thu, Oct 22, 2009 at 5:19 PM, Chad Bellan <chad.bellan@...> wrote:

If you mean the url: http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/html/HtmlImage.html

 

I don't see an option to force the download of images.  Can you help me further with this?

 

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 

From: Daniel Gredler [mailto:djgredler@...]
Sent: Thursday, October 22, 2009 4:58 PM
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Htmlunit and images

 

Hi Chad,

By default, HU only downloads images with onload event handlers. You can force image download though; see the HtmlImage javadocs for more info.

Take care,

Daniel


On Thu, Oct 22, 2009 at 1:12 PM, Chad Bellan <chad.bellan@...> wrote:

Does htmlunit request images? 

                If yes, are there certain requirements for images to also be loaded when a webpage is opened (ie:  css on, JS on, etc…)? 

 

Chad

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Htmlunit and images

by Marc Guillemot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

to be precise: HtmlUnit doesn't have (currently) any option to
automatically download all images.

Cheers,
Marc.

Daniel Gredler a écrit :

> Hi Chad,
>
> All of the methods marked "POTENIAL PERFORMANCE KILLER - DOWNLOADS THE
> IMAGE - USE AT YOUR OWN RISK" trigger the download.
>
> Take care,
>
> Daniel
>
>
>
> On Thu, Oct 22, 2009 at 5:19 PM, Chad Bellan <chad.bellan@...
> <mailto:chad.bellan@...>> wrote:
>
>     If you mean the url:
>     http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/html/HtmlImage.html
>
>      
>
>     I don't see an option to force the download of images.  Can you help
>     me further with this?
>
>      
>
>      
>
>     *Chad Bellan*
>
>     *LUSIGHT RESEARCH*
>
>     t. +1.416.934.7253
>
>     chad.bellan@... <mailto:chad.bellan@...>
>
>      
>
>     Please visit us at www.lusight.com <http://www.lusight.com/>
>
>      
>
>     This message is confidential and may be privileged.  If you are not
>     the intended recipient, we kindly ask you to inform the sender.  Any
>     un-authorized dissemination or copying hereof is prohibited.  This
>     message serves for information purposes only and shall not have any
>     legally binding effect.  Given that e-mails can easily be subject to
>     manipulation, we can not accept any liability for the content provided.
>
>      
>
>      
>
>     *From:* Daniel Gredler [mailto:djgredler@...
>     <mailto:djgredler@...>]
>     *Sent:* Thursday, October 22, 2009 4:58 PM
>     *To:* htmlunit-user@...
>     <mailto:htmlunit-user@...>
>     *Subject:* Re: [Htmlunit-user] Htmlunit and images
>
>      
>
>     Hi Chad,
>
>     By default, HU only downloads images with onload event handlers. You
>     can force image download though; see the HtmlImage javadocs for more
>     info.
>
>     Take care,
>
>     Daniel
>
>
>     On Thu, Oct 22, 2009 at 1:12 PM, Chad Bellan
>     <chad.bellan@... <mailto:chad.bellan@...>> wrote:
>
>     Does htmlunit request images?
>
>                     If yes, are there certain requirements for images to
>     also be loaded when a webpage is opened (ie:  css on, JS on, etc…)?
>
>      
>
>     Chad
>
>      
>
>     *Chad Bellan*
>
>     *LUSIGHT RESEARCH*
>
>     t. +1.416.934.7253
>
>     chad.bellan@... <mailto:chad.bellan@...>
>
>      
>
>     Please visit us at www.lusight.com <http://www.lusight.com/>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Htmlunit and images

by Chad Bellan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

These methods are for an HtmlImage, so I have to get all HtmlImages from the current webPage.

1.  How do I get the all htmlImages on the webPage?

2.  What if they are background images (background of the webpage, background of a button, etc…)

 

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 

From: Daniel Gredler [mailto:djgredler@...]
Sent: Thursday, October 22, 2009 6:48 PM
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Htmlunit and images

 

Hi Chad,

All of the methods marked "POTENIAL PERFORMANCE KILLER - DOWNLOADS THE IMAGE - USE AT YOUR OWN RISK" trigger the download.

Take care,

Daniel


On Thu, Oct 22, 2009 at 5:19 PM, Chad Bellan <chad.bellan@...> wrote:

If you mean the url: http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/html/HtmlImage.html

 

I don't see an option to force the download of images.  Can you help me further with this?

 

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 

From: Daniel Gredler [mailto:djgredler@...]
Sent: Thursday, October 22, 2009 4:58 PM
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Htmlunit and images

 

Hi Chad,

By default, HU only downloads images with onload event handlers. You can force image download though; see the HtmlImage javadocs for more info.

Take care,

Daniel

On Thu, Oct 22, 2009 at 1:12 PM, Chad Bellan <chad.bellan@...> wrote:

Does htmlunit request images? 

                If yes, are there certain requirements for images to also be loaded when a webpage is opened (ie:  css on, JS on, etc…)? 

 

Chad

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: Htmlunit and images

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Chad,

1. HtmlPage.getByXPath("//img")

2. Sorry, no way to do this right now (that I'm aware of).

Take care,

Daniel


On Mon, Oct 26, 2009 at 3:44 PM, Chad Bellan <chad.bellan@...> wrote:

These methods are for an HtmlImage, so I have to get all HtmlImages from the current webPage.

1.  How do I get the all htmlImages on the webPage?

2.  What if they are background images (background of the webpage, background of a button, etc…)

 

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 

From: Daniel Gredler [mailto:djgredler@...]
Sent: Thursday, October 22, 2009 6:48 PM


To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Htmlunit and images

 

Hi Chad,

All of the methods marked "POTENIAL PERFORMANCE KILLER - DOWNLOADS THE IMAGE - USE AT YOUR OWN RISK" trigger the download.

Take care,

Daniel


On Thu, Oct 22, 2009 at 5:19 PM, Chad Bellan <chad.bellan@...> wrote:

If you mean the url: http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/html/HtmlImage.html

 

I don't see an option to force the download of images.  Can you help me further with this?

 

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 

From: Daniel Gredler [mailto:djgredler@...]
Sent: Thursday, October 22, 2009 4:58 PM
To: htmlunit-user@...
Subject: Re: [Htmlunit-user] Htmlunit and images

 

Hi Chad,

By default, HU only downloads images with onload event handlers. You can force image download though; see the HtmlImage javadocs for more info.

Take care,

Daniel

On Thu, Oct 22, 2009 at 1:12 PM, Chad Bellan <chad.bellan@...> wrote:

Does htmlunit request images? 

                If yes, are there certain requirements for images to also be loaded when a webpage is opened (ie:  css on, JS on, etc…)? 

 

Chad

 

Chad Bellan

LUSIGHT RESEARCH

t. +1.416.934.7253

chad.bellan@...

 

Please visit us at www.lusight.com

 

This message is confidential and may be privileged.  If you are not the intended recipient, we kindly ask you to inform the sender.  Any un-authorized dissemination or copying hereof is prohibited.  This message serves for information purposes only and shall not have any legally binding effect.  Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.

 

 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user




--
Daniel Gredler
http://daniel.gredler.net/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user