Monday, February 7, 2011

Is there an equivalent to Java's Robot class (java.awt.Robot) for Perl?

Is there an equivalent to Java's Robot class (java.awt.Robot) for Perl?

  • There is on Linux/Unix:

    http://sourceforge.net/projects/x11guitest

    I'm not familiar of anything similar for Windows or Mac that uses Perl.

    From bmdhacks
  • If you're looking for a way to control a browser for the purpose of functional testing, Selenium has Perl bindings: http://selenium.openqa.org/

    From Fhoxh
  • For X (Linux/Unix), there's X11::GUITest.

    For Windows, there's Win32::CtrlGUI, although it can be a bit tricky to install its prerequisites.

    From cjm
  • On Windows, I've always used Win32::GuiTest.

  • Alternatively, you can surely use the WWW::Mechanize module to create a agent as we do here at work. We have a tool called AppMon that is really just a dramatized wrapper around Mechanize.

    The Mechanize module allows you to use scripts that look a lot like this:

    use WWW::Mechanize;
    
    my $Agent = WWW::Mechanize->new(cookie_jar => {});
    
    $Agent->get("http://www.google.com/search?q=stack+overflow+mechanize");
    print "Found Mechanize" $Agent->content =~ /WWW::Mechanize/;
    

    and will result in "Found Mechanize" being output. This is a very simple script, but rest assured you can interact with forms quite well as well.

    You can also move to Ruby and use Watir, but Selenium is another alternative, albeit not as interesting (in terms of coding) or automate-able. Selenium has a firefox extension that is quite useful for creating the selenium scripts and can change them between the various languages that it supports, which is pretty extensive in terms of automation.

0 comments:

Post a Comment