[RndTbl] store changes made to web page

Dan Martin ummar143 at shaw.ca
Sun Apr 29 23:28:14 CDT 2012


On 2012-04-29, at 10:14 PM, Trevor Cordes wrote:

> On 2012-04-25 Dan Martin wrote:
>> Does anyone have ideas on how I can save the modified DOM tree, the
>> one that displays on the web page?
> 
> Welcome to modern browser hell :-)
> 
> If you are saving it manually, use the "Web Developer 1.1.9" add-on in
> firefox and use its View Source -> View Generated Source option and
> then save from there.
> 
> Also, perl cpan WWW::Mechanize::Firefox should be able to save the
> post-DOM-changes version if you pause long enough or wait for the
> correct events (or trigger it manually).  I use it extensively.
> _______________________________________________
> Roundtable mailing list
> Roundtable at muug.mb.ca
> http://www.muug.mb.ca/mailman/listinfo/roundtable

I will definitely look into Web Developer.  I may review mechanize - I think ruby has a mechanize which is simply hooks to the perl mechanize, but I could be wrong.

In the meantime, I have found that if I add elements and text nodes directly, these changes seem to show in firebug and persist through a "save" operation.  Since attribute changes do not show, including the value attributes of inputs, I have attached text nodes which my javascript scripts modify in addition to the values.

I cannot attach text nodes to textbox inputs.  I make the skeleton DOM in ruby's REXML library.  Displaying the html in text form shows that the correct tags/content are generated, but firefox rearranges things so that the text belongs to the node containing the input.  I changed all of my textbox inputs to textareas, which can contain text nodes, only to find I had no way to store the results of my checkboxes.

I finally created an XML tree inside a div which is invisible, for the sole purpose of storing results.  It has the added benefit of sensible tag names and is easier to scrape afterward.

Using html as my GUI turned out to be a lot harder than I anticipated, though I think I am close to getting it done now.

Dan Martin
GP Hospital Practitioner
Computer Scientist
ummar143 at shaw.ca
(204) 831-1746
answering machine always on




More information about the Roundtable mailing list