Perl 是否有与 Java 的 Robot 类 (java.awt.Robot) 等效的类?

发布于 2024-07-04 05:53:18 字数 54 浏览 13 评论 0原文

Perl 是否有与 Java 的 Robot 类 (java.awt.Robot) 等效的类?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

向日葵 2024-07-11 05:53:19

在 Windows 上,我一直使用 Win32:: GuiTest

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

零時差 2024-07-11 05:53:19

对于 X (Linux/Unix),有 X11::GUITest

对于 Windows,有 Win32::CtrlGUI,尽管它可能有点棘手安装其先决条件。

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.

蓝眼泪 2024-07-11 05:53:19

如果您正在寻找一种控制浏览器以进行功能测试的方法,Selenium 具有 Perl 绑定:http:// /selenium.openqa.org/

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/

滿滿的愛 2024-07-11 05:53:19

Linux/Unix 上有:

http://sourceforge.net/projects/x11guitest

我不熟悉使用 Perl 的 Windows 或 Mac 类似的东西。

There is on Linux/Unix:

http://sourceforge.net/projects/x11guitest

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

小伙你站住 2024-07-11 05:53:18

或者,您当然可以使用 WWW::Mechanize 模块来创建代理,就像我们在工作中所做的那样。 我们有一个名为 AppMon 的工具,它实际上只是 Mechanize 的戏剧化包装。

Mechanize 模块允许您使用看起来很像这样的脚本:

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/;

并将导致输出“Found Mechanize”。 这是一个非常简单的脚本,但请放心,您可以很好地与表单交互。

您还可以迁移到 Ruby 并使用 Watir 或 Selenium 作为另一种替代方案,尽管不那么有趣(就编码而言)或可自动化。 Selenium 有一个 firefox 扩展,对于创建 selenium 脚本非常有用,并且可以在它支持的各种语言之间更改它们,这在自动化方面相当广泛。

更新 - 2016 年 11 月

虽然我没有太多机会使用它,但大多数语言也有 webdriver 包,Perl 也不例外。

Selenium::Remote::驱动程序

Alternatively, you can surely use the WWW::Mechanize module to create an 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.

You can also move to Ruby and use Watir, or Selenium as 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.

Update - Nov 2016

Although I haven't had much of an opportunity to play with it, there are also webdriver packages for most languages, and Perl is no different.

Selenium::Remote::Driver

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文