Hello Monks,
I'm trying to extract text data from a webpage, with many javascript code in it.
I'm able to go through the page, but when I'm finally there, I'm not able to get the information, since they are retained in javascript runtime variables (should the name for those be DOM? pretty confused).
I identified wanted text section through FireBug, in the DOM panel section.
The DOM object where they are retained seems like an array, that is called Diary.
I'm not able to access it in perl, using eval() or eval_in_page() methods.
I tried this piece of code:
my ($contest, $type) = $mech2->eval_in_page( 'Diary' ) or warn "$!";
print Dumper \$contest;
print Dumper \$type;
Resulting in:
MozRepl::RemoteObject: ReferenceError: Diary is not defined at ./test.pl line 144.
Of course content() or text() methods return only empty textareas..
I'm searching good suggestions. I would like if possibile to inject JS code to dump every single variable that is readable in current page context..I'm afraid that Diary is not readable or out of scope..There is a way to do this? thanks for any help or good suggestion.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.