Browser Status from Perl

Posted on 2004-11-13
Last Modified: 2010-03-05
I am looking to launch opera from a perl script. This part I have done:

system ("opera $ARGV[0]");

I want the script to wait until the page is done loading, and then do something else. The problem is that I don't know how to get the status out of opera. Does anyone know how to do this? I am presently using a sleep command, but that is not good enough for my application.

I thought of using the following line:

$browser_status  = system ("opera $ARGV[0]");

But, browser status comes back as a 0 before the browser loads anything.

Basically I want to do two things:

1.) Have the script wait until the page is done loading in the browser.

2.) Have the script be aware if there was a problem loading the script. (If possible) I know this is possible with lwp, but for what I am looking to do, lwp will not work. Now, if it is not possible to get opera to admit there was a problem with the page, I can use lwp to see if the page returns an error. But I would like to just use opera...

Any ideas?
Question by:stakor
    LVL 18

    Expert Comment

    I don't think Opera will give you that information through its STDOUT.
    I tried this:

        $ret = `opera $ARGV[0]`;
        print $ret;

    but all I got was:

        VXMLPlugin::PrepareToSend 2

    What is it you're trying to do, and why do you think it can't be done with lwp?
    Have a look at WWW::Mechanize.

    Author Comment

    I am trying to create a screenshot of a site. I was using opera, and Image::Magick to do this. I am unaware of anything that is in lwp that would allow me to do this. (Though, I will look up WWW::Mechanize)  The idea is to go through a list of sites, and take a snapshot of them. Is this something that could be done with WWW::Mechanize?
    LVL 18

    Expert Comment

    I know this question has come up in the past. Let me see if I can find a reference to it.
    LVL 18

    Accepted Solution


    Author Comment

    I was hoping that it would go differently, but I guess there is no easy way to do it. The points will go to the best answer. (Only Answer)

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
    Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now