Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Best way to parse/evaluate HTML page contents for apparent image size

by Anonymous Monk
on Dec 14, 2012 at 08:05 UTC ( #1008797=note: print w/ replies, xml ) Need Help??


in reply to Re: Best way to parse/evaluate HTML page contents for apparent image size
in thread Best way to parse/evaluate HTML page contents for apparent image size

With all due respect, the question isn't about various HTML development practices. The question is, could someone who has used perl to automate graphical web browsers (or their underlying rendering engines) recommend a library to work with the rendered image sizes in a given browser context. I'm guessing that if you have never used (for example, from doing a search on various rendering engines in CPAN) Mozilla::Mechanize, or WWW::Mechanize, or WWW::WebKit, or something else like it I'm unaware of, you'll be of limited help in making a recommendation.


Comment on Re^2: Best way to parse/evaluate HTML page contents for apparent image size
Re^3: Best way to parse/evaluate HTML page contents for apparent image size
by sundialsvc4 (Monsignor) on Dec 14, 2012 at 11:01 UTC

    And my sincere opinion here is that if you want to determine the effective size of an image on the browser screen, there are many factors which influence this.   (And yes, I hadn’t even considered CSS.)   Sure, all these tools exist for getting to the HTML, etc., but that’s only the tip of the question being posed as I read it.   There are so many potentially influencing variables here, apart from the HTML itself, that the objective is at best difficult to answer.   I found the question as-stated to be vague, as in, difficult to ascertain what potential factors were intended to be in-bounds or not.   Getting to the HTML and/or CSS elements in Perl, fortunately, is a technical matter that has been very-well solved by CPAN.

      I think you misunderstand what the various mechanize tools offer. You are manipulating a browser like Firefox that will offer you access to it's DOM and rendered image sizes... after it has been rendered, after all the CSS rules have been applied, and various directives like "px" or "%" values of the images have been applied.
Re^3: Best way to parse/evaluate HTML page contents for apparent image size
by Anonymous Monk on Dec 14, 2012 at 11:08 UTC
      Yes, it looks like $mech->element_coordinates( $element ) will do precisely what I need. A series of arithmetic operations should quickly give me actual rendered image size, thank you.

      In absence of someone saying 'ah, but this module is better' or 'that module is pure perl', I'm planning on going this route.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008797]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2014-09-19 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (131 votes), past polls