http://www.perlmonks.org?node_id=1061128

cf006 has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I am new on this forum and first I would like to greet all the perlmonks.
My question is about the use of MozRepl module.
I have installed the add-on MozRepl for firefox and started it. The MozRepl perl module is of course installed.
I would like to automate some tasks with firefox, and think it is a good idea to use MozRepl.
For simple examples, it seems to work good.
For instence, in the following code, after the connection to mozrepl, I load a new html page and execute some instructions, to get all the links in the page. Then, still using commands that I could use in a console mode, I create the function all_a without parameter to display all the links founded before using the javascript function 'alert', and finaly click on the fourth link of the list.

#!/usr/bin/perl -w use strict; use warnings; use MozRepl; my $repl = MozRepl->new; $repl->setup; $repl->execute('content.document.location.href="http://www.google.fr/f +irefox"'); $repl->execute('repl.whereAmI()'); $repl->execute('repl.enter(content)'); $repl->execute('a = document.getElementsByTagName("a")'); $repl->execute('function all_a() {var all=""; for(var i=0;i<a.length;i +++) {all += i + ":" +a[i] + "\n"; } alert(all); };'); $repl->execute('all_a()'); $repl->execute('a[3].click()'); <>;

That's good but not satisfying, especially if I want to explore deeper data contained in the DOM, and that's why I thought to use MozRepl::RemoteObject, in addition to MozRepl. So, after reading the manual of MozRepl::RemoteObject, I proceed as follow, to connect the two modules :

#!/usr/bin/perl -w use strict; use warnings; use MozRepl; use MozRepl::RemoteObject; my $repl = MozRepl->new; $repl->setup({ log => [qw/ error info /], plugins => { plugins => [qw[ JSON2 ]] }, }); my $bridge = MozRepl::RemoteObject->install_bridge(repl => $repl); <>;

But, at this stage, I have the following error message :
"command timed-out at C:/Perl/site/lib/MozRepl/Client.pm line 186"
and the script dies.
I reproduced this result with Windows XP and with Linux Debian Squeeze.
I try to make a script working for now several weeks, and I didn't manage to automate tasks with firefox. I wonder if I should not give up.
Is it the right way to do what I want ?
Thank's for any information that could help me.
cf006