简体   繁体   English

如何同时单击2个按钮?

[英]How can I click 2 buttons simultaneously?

I work in a Call center (ticket based Support) and for me to get a ticket I need to click on 2 Buttons.我在呼叫中心工作(基于票的支持),为了获得票,我需要单击 2 个按钮。 the one that opens the tickets section, and the one that actually gets me a ticket.打开门票部分的那个,以及实际上给我一张票的那个。 After i click on the Get_ticket class, the ticket box closes.单击 Get_ticket 类后,票框关闭。 So i need to start again to click on the "Tickets" Button, and then on Get_Ticket.所以我需要重新开始点击“Tickets”按钮,然后点击Get_Ticket。 Tickets button -> Get_ticket.门票按钮 -> Get_ticket。 And repeat and repeat.并重复和重复。 I want to tell Google console to help me with this.我想告诉 Google 控制台帮我解决这个问题。 I found a way but it's not very friendly.我找到了一种方法,但它不是很友好。 I tried with the button.click function at a different interval but it's not working...If i put the function separately, it's working, but when I put the functions at the same time in Console, it's not working.我尝试以不同的时间间隔使用 button.click 功能,但它不起作用......如果我单独放置该功能,它会起作用,但是当我将这些功能同时放入控制台时,它不起作用。 Can you please give me an advice ?你能给我一个建议吗? Those are the functions:这些是功能:

1.(click on TICKETS) 1.(点击门票)

var button = document.getElementsByClassName("_1f8o8ru7")[0];
setInterval(function(){button.click();},2000);

2.(Click on GET TICKET) 2.(点击获取门票)

var button2 = document.getElementsByClassName("_sl2x43m")[0];
setInterval(function(){button2.click();},2500);

您需要调用第一个按钮单击第一个按钮在给定超时时调用另一个方法,因此第一次单击第一个按钮后单击第一个按钮调用具有 500 次超时的另一个按钮方法就可以了,无需执行 2000 或 2500 次超时

The second interval should be added inside the first interval.第二个区间应添加在第一个区间内。 I also recommend to use setTimeout , instead of setInterval .我还建议使用setTimeout ,而不是setInterval

setInterval(function(){
   var button = document.getElementsByClassName("_1f8o8ru7")[0];
   button.click();
   setInterval(
       function(){
          var button2 = document.getElementsByClassName("_sl2x43m")[0];
          button2.click();
   },2500);
},2000);

After you figure it out, you can save your code in a js file: my_script.js and use Chrome extension JS Injector to automatically inject it in your page, without needing to use Chrome DEV Tools.搞清楚之后,你可以将你的代码保存在一个js文件中: my_script.js并使用Chrome扩展JS Injector自动将其注入到你的页面中,而无需使用Chrome DEV工具。

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

相关问题 我怎样才能点击特定按钮而不是所有按钮 - How can I how to click specific button but not all buttons 如何将单击事件添加到带有位置的按钮数组中? - How can I add click events to an array of buttons with their position? 如何使用JQuery将点击功能分配给许多按钮? - How can I assign click function to many buttons using JQuery? 单击后如何在按钮数组中禁用特定按钮? - How can I disable a particular button after click, in a buttons array? 在进行循环时如何单击按钮? - How can I click in buttons while doing for loop? 如何强制单击表单中的切换按钮之一? - How can i make mandatory to click one of the toggle buttons in form? 如何在一个“单击”事件中同时从我的云 Firestore 中的两个集合中删除两个文档? - How can I simultaneously in one "click" event delete two documents from two collection in my cloud firestore? 如何在本机反应中同时启用多个按钮的触摸? - How do I enable touch on multiple buttons simultaneously in react native? HTML5点击会同时发送到两个按钮 - HTML5 click is sent to two buttons simultaneously 当单击鼠标关闭导航栏时,如果单击的是这样的项目,我如何关闭链接或执行按钮? - When the navbar closes with a click away, how i can turn off following links or excecute buttons, if the click was on such an item?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM