简体   繁体   English

使用IPC实现连续无头页面自动化

[英]Continuous headless page automation with IPC

I need to make a headless (for a docker container) app that waits for an external signal and then acts on that signal by clicking on several html elements (selectors, buttons, links) and filling in some input fields. 我需要制作一个无头(对于一个docker容器)应用程序等待外部信号,然后通过单击几个html元素(选择器,按钮,链接)并填写一些输入字段来对该信号进行操作。 All this can be done using jQuery, I know how to do that. 所有这些都可以使用jQuery完成,我知道如何做到这一点。

The app needs to keep the page loaded so it can act immediately, reloading the page every time is taking too long. 该应用程序需要保持页面加载,以便它可以立即采取行动,每次重新加载页面花费的时间太长。 The whole action of receiving a signal and filling in a form and submit it, should be done under one second. 接收信号并填写表格并提交表格的整个行动应在一秒钟内完成。

I made an electron app that does all this but I need to make the app headless so it can be run inside a docker container. 我做了一个电子应用程序来做所有这些,但我需要使应用程序无头,所以它可以在docker容器内运行。

It looks like Phantomjs could do this but I see two problems: 看起来Phantomjs可以做到这一点,但我看到两个问题:

The Phantom script needs to keep the web page loaded as the web page I need to automate is very heavy, it can take more than a minute to load. Phantom脚本需要保持网页加载,因为我需要自动化的网页非常繁重,加载可能需要一分多钟。

The Phantom script needs to be able to receive a signal and report back on the progress. Phantom脚本需要能够接收信号并报告进度。 HTTP or file based is too slow, I'd like to use websockets for this communication. 基于HTTP或文件太慢,我想使用websockets进行此通信。

I hope someone can point me to the right tools for this and/or point me to some examples how to achieve this. 我希望有人可以指出我正确的工具和/或指出一些如何实现这一目标的例子。

I would like to use Javascript, but if there is a perfect solution in an another modern language, I have no problem to use that. 我想使用Javascript,但如果有另一种现代语言的完美解决方案,我可以使用它。

我设法使用Electron在Docker容器内工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM