使用JavaScript在Instagram故事中自动单击的一种方法
我一直在尝试开发一种单击 Instagram 故事文本区域的方法,以便它可以使用开发工具打开“快速反应”框。
我一直在许多网站上练习这种方法,仅使用 querySelector 来获取元素并在之后使用“click()”,但在这种情况下它不起作用。
我尝试选择我想要单击的文本区域的所有父级,希望其中一个具有单击功能或类似功能。
还尝试在元素上使用dispatchEvent创建模拟单击函数,如下所示:
element.dispatchEvent(new MouseEvent(eventName, {
view: window,
bubbles: true,
cancelable: true
}));
在某些情况下,“eventName”可能是“mouseup”,“mousedown”,“click”。
尝试使用 getBoundingClientRect 获取元素的坐标,并在调度事件中使用它来模拟另一次单击,并在执行此操作时尝试使用位置信息计算框的中心。
这些方法都不起作用,此时,我只是好奇这里发生了什么,我一直在尝试自动化许多网站只是为了好玩,我的目标是自动单击以打开快速反应框并单击一个反应。
感谢您提前回复,我真的很想对此有更好的了解。
I've been trying to develop a way into clicking an Instagram stories textarea, so it can open the "quick reactions" box using the DevTools.
I have been practicing this approach at many websites using just querySelector to get the element and a "click()" after, but it does not work in this case.
I've tried to select all parents of the textarea I want to click, hoping that one of them has an on-click function or something like that.
also tried to create a simulate click function using dispatchEvent at the element, something like this:
element.dispatchEvent(new MouseEvent(eventName, {
view: window,
bubbles: true,
cancelable: true
}));
Where in some cases, "eventName" could be "mouseup", "mousedown", "click".
Tried to get the coordinates of the element using getBoundingClientRect, and used it in a dispatchEvent to simulate another click, and while doing it, tried to calculate the center of the box using the position info.
None of these approaches worked, at this point, I'm just curious about what's happening here, I've been trying to automate many websites just for fun, and my goal here was to automate a click to open the quick reactions box and click a reaction.
Thanks for any response in advance, I would really like to have a better understanding of this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论