canoo 或 jwebUnit 用于自动化无头 Web 客户端?

发布于 2024-12-02 00:59:23 字数 339 浏览 0 评论 0原文

我正在用 grails 用 groovy 编写一个应用程序,它需要对几个网站进行一些自动使用。因此,我需要能够执行与功能性 Web 应用程序测试类似的任务,而不需要浏览器。我还希望它尽可能轻,当然是完全无头的。

到目前为止,我知道有两种选择。 Canoo 有一个不错的 grails 插件,还有一个方便的 firefox 记录器插件和 EasyB/JWebUnit,可以使用 Selenium 进行记录。

Canoo 看起来很重,我不知道我需要做什么才能让它在 grails 服务中整齐地运行。

也许我的想法是错误的。这里有人用 Java 或 Groovy 做过这种事情吗?也许我最好放弃在命令行上使用curl ?

I'm writing an application in groovy with grails that needs to do some automated usage of a couple of websites. So I need something that will perform a similar task to functional web application testing, without a browser being needed. I would also like it to be as lightweight as possible and of course completely headless.

There are two options that I am aware of so far. Canoo which has a nice grails plugin and conveniently also a firefox recorder plugin and EasyB/JWebUnit which can be recorded with Selenium.

Canoo seems very heavy and I don't know what I'd have to do to get it to run in a grails service neatly.

Perhaps I'm thinking about this wrongly though. Has anyone here done this kind of thing in Java or Groovy? Am I better off just dropping out to curl on the command line perhaps?

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

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

发布评论

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

评论(1

十六岁半 2024-12-09 00:59:23

您是否考虑过只发送网络请求?也许您不需要一个完整的无头浏览器,这样的一行

def html = new Url("http://example.com").text

就足够您的应用程序使用了?

当您必须单击虚拟按钮时,测试工具或框架非常有用。但如果您只需远程控制网站,发送请求就足够了。

更新:如果您需要发送 POST 请求并处理 cookie,那么 Url-Class 是不够的。但您可以改用 http 构建器。以下是两个可以帮助您入门的 URL:

Have you though about just sending your web requests? Maybe you don't need a full blown headless browser and a line like

def html = new Url("http://example.com").text

is enough for your app?

A testing tool or framework is great when you have to click virtual buttons. But if you only have to remote control a website, sending a request could be enough.

Update: if you need to send POST requests and handle cookies, then the Url-Class isn't enough. But you can use the http builder instead. Here are two URLs which will get you started:

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