Evening to you all.

Just to give this thread a bit of a conclusion: I think indeed that the right way to go is to look at the AJAX, that is definitely the only way to get out of reloading the page. I have been digging into the code, and it does indeed contain a lot of XMLHttpRequest calls.

As to the best way to implement watching of this particular page, the key - I humbly think - lies in the fact that the page watches itself, and that it - probably - does it in a rather reliable way. So the code in the end should just look something like:

use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(); $mech->autoclose_tab( 0 ); $mech->get("$URL"); while (1) { $mech->events( "document.database_changed_function()" ); #not got this part working yet... };

I agree that one interesting avenue would have been Selenium, and I now remember that at the very onset of all this, before I figured out that the "button" was a simple POST request hidden under a thousand layers of Javascript, I had looked a Selenium for its "imitation" capability (script what you do). Never went too far down that avenue though.

What I am confronted with now is the sheer complexity of the JS in this page. I am having a million issues with scope and such whenever I try to get Mechanize::Firefox to interact with the page. It's written using angularjs.org which in and of itself is super cool, but insanely complex as far as the JS goes (no doubt the JS gurus would contradict me there but hey, I'm not a javascript guy!)

So here I am, trying to figure out which function is supposed to keep a watch on the database of translations, and what scope all this is happening in...

Maybe I'll figure it out (preferably before the site migrates to Angular 2 and the whole thing changes, haha), maybe not, but in any case I'm learning a lot of JS, and perl too for that matter, the Mech::FF module is quite instructive.

Once again thanks for your help and for hearing me out. Appreciate all the kind comments.

Will be back soon with some more questions no doubt.

All the best to you all,
Regards, Mark.


In reply to Re: Fast efficient webpage section monitoring by Marcool
in thread Fast efficient webpage section monitoring by Marcool

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.