使用 JavaScript 在一天中的特定时间自动打开浏览器的方法?
有没有办法在我的计算机处于打开状态但没有打开任何内容的情况下打开浏览器并使用 JavaScript 自动执行任务?也许使用 NodeJS?澄清一下,我不是在谈论像 window.open()
这样的 JS 方法,而是在硬件级别上自动化任务。
例如:
- 周三中午 12:00 打开 Chrome。
- 访问 google.com。
- 登录。
如果 JavaScript 无法做到这一点,我应该学习哪种语言最接近 JavaScript 语法?
Is there a way to open browser and automate tasks using JavaScript while my computer is on but without having anything opened? Perhaps using NodeJS? Just to clarify, I'm not talking about JS methods like window.open()
, I'm talking about automating tasks on hardware level.
For instance:
- Open Chrome at 12:00PM on Wednesday.
- Go to google.com.
- Sign in.
If JavaScript can't do it, what language should I learn that's closest to JavaScript syntax?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Node Js 中,您需要启动一个服务器来为您完成这项工作。这是我用来打开浏览器的代码,其 URL
const { platform } = require('os');
const { exec } = require('child_process');
const WINDOWS_PLATFORM = 'win32';
const MAC_PLATFORM = '达尔文';
现在您可以花时间使用以下代码,
这些代码的组合有望满足您的需要。谢谢
请阅读本文,了解有关如何登录网站的更多信息 https://marian-caikovski.medium.com/automatically-sign-in-with-google-using-puppeteer-cc2cc656da1c
In Node Js, you need to spin up a server that will do this job for you. Here is the code i have used to open up a browser with a URL
const { platform } = require('os');
const { exec } = require('child_process');
const WINDOWS_PLATFORM = 'win32';
const MAC_PLATFORM = 'darwin';
Now you can get time with following code
Combination of these will be hopefully work the thing you need. thanks
Please follow this article for further information on how to sign into a website https://marian-caikovski.medium.com/automatically-sign-in-with-google-using-puppeteer-cc2cc656da1c