使用 Python 自动化 Java 小程序

发布于 2024-12-24 00:56:42 字数 217 浏览 2 评论 0原文

在工作中,我需要每 20-30 分钟运行一个 Java 小程序来重新连接到内部之一 应用程序。

我想自动登录该应用程序的网站,然后运行这个根本不需要任何输入的 Java 小程序,只需接受它,这样我就可以在每次应用程序注销时运行该脚本。

有什么方法可以使用 urllib 或类似的库在 Python 中做到这一点吗? 我知道如何执行登录部分,但我不知道如何执行“接受并运行此小程序”部分。

At work I need to run a Java applet every 20-30 min to re-connect to one of the internal
applications.

I would like to automate the login in the website of this application and then run this Java applet that does not require any input at all, just accept it so I can just run the script every time the application logs me off.

Is there any way I can do this from Python using urllib or a similar library?
I know how to do the login part, but I don't know what to do the 'accept and run this applet' part.

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

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

发布评论

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

评论(1

妖妓 2024-12-31 00:56:42

Web 应用程序测试框架对于您的要求非常有用,它允许您模拟用户与网站的交互(POST、GET、登录、点击等)。

你的问题的棘手部分是与 Java 小程序交互 - 没有多少 Web 应用程序测试框架允许你这样做;特别是我不知道提供该功能的Python框架,但根据我的经验,我发现 HTTPUnit与小程序配合良好。当然,它是用 Java 编写的,而不是用 Python 编写的,但值得一看。

A web application testing framework would be useful for what you ask, it allows you to simulate the interactions of an user (POST, GET, login, clicks, etc.) with a web site.

The tricky part of your question, is interacting with a Java applet - not many webapp testing frameworks will allow you to do that; in particular I don't know a Python framework that offers that functionality, but in my experience, I found that HTTPUnit worked well with applets. Of course, it's in Java and not in Python, but it's worth checking out.

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