<legend id='SZFH0'><style id='SZFH0'><dir id='SZFH0'><q id='SZFH0'></q></dir></style></legend>
    • <bdo id='SZFH0'></bdo><ul id='SZFH0'></ul>

    <i id='SZFH0'><tr id='SZFH0'><dt id='SZFH0'><q id='SZFH0'><span id='SZFH0'><b id='SZFH0'><form id='SZFH0'><ins id='SZFH0'></ins><ul id='SZFH0'></ul><sub id='SZFH0'></sub></form><legend id='SZFH0'></legend><bdo id='SZFH0'><pre id='SZFH0'><center id='SZFH0'></center></pre></bdo></b><th id='SZFH0'></th></span></q></dt></tr></i><div id='SZFH0'><tfoot id='SZFH0'></tfoot><dl id='SZFH0'><fieldset id='SZFH0'></fieldset></dl></div>
      <tfoot id='SZFH0'></tfoot>

      <small id='SZFH0'></small><noframes id='SZFH0'>

      1. Selenium WebDriver/Java - 模拟人类光标移动

        时间:2023-09-28

          <tfoot id='q1cSB'></tfoot>

            • <bdo id='q1cSB'></bdo><ul id='q1cSB'></ul>

              <small id='q1cSB'></small><noframes id='q1cSB'>

                <tbody id='q1cSB'></tbody>
                <legend id='q1cSB'><style id='q1cSB'><dir id='q1cSB'><q id='q1cSB'></q></dir></style></legend>
                  <i id='q1cSB'><tr id='q1cSB'><dt id='q1cSB'><q id='q1cSB'><span id='q1cSB'><b id='q1cSB'><form id='q1cSB'><ins id='q1cSB'></ins><ul id='q1cSB'></ul><sub id='q1cSB'></sub></form><legend id='q1cSB'></legend><bdo id='q1cSB'><pre id='q1cSB'><center id='q1cSB'></center></pre></bdo></b><th id='q1cSB'></th></span></q></dt></tr></i><div id='q1cSB'><tfoot id='q1cSB'></tfoot><dl id='q1cSB'><fieldset id='q1cSB'></fieldset></dl></div>
                  本文介绍了Selenium WebDriver/Java - 模拟人类光标移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想在 Facebook 广告管理器中自动执行一项简单的任务.此任务涉及设置活动和上传一些广告.人类可能需要 30 分钟才能做到这一点.然而,他们每次都在做同样的事情.经常有错误.这应该是自动化的.没有人的情感或错误就完成了.

                  I want to automate a simple task inside Facebook Ads Manager. This task involves setting up a campaign and uploading some ads. It can take a human 30 minutes to do this. However, they're doing the same thing every single time. Often with mistakes. It's something that should be automated. Done without human emotion or mistakes.

                  Facebook 非常敏感,我不希望它因为错误的原因禁止我.所以我需要感受人性.我可以在点击之间花时间.但是,光标移动本身需要感觉人性化.出于道德目的,我只需要模拟真实的人类点击.

                  Facebook is very sensitive and I don't want it to ban me for the wrong reasons. So I need to feel human. I can take my time between clicks. However, the cursor movement itself needs to feel human. I only need to simulate a real human click for ethical purposes.

                  假设我得到了一个想要将光标移向的元素:

                  Say I get an element I want to move my cursor towards:

                  WebDriver driver;    
                  
                  // Set file path of chrome driver
                  System.setProperty("webdriver.chrome.driver", "C:\chromedriver.exe");
                  
                  // Create object
                  ChromeDriver driver = new ChromeDriver(options);
                  
                  // Go to URL
                  driver.get("FACEBOOK URL");
                  
                  // Get element
                  driver.findElement(By.xpath("//span[contains(text(), 'Setup Campaign')]");
                  

                  像真人一样将光标移向该元素的最佳方法是什么?

                  What is the best way to move my cursor towards this element as a real human would?

                  • 真正的人类会首先移动鼠标.不只是点击元素

                  • A real human would first move the mouse. Not just click the element

                  他们会缓慢移动鼠标/光标.最多可能需要 500-1000 毫秒.当然不是立即.

                  They would move the mouse/cursor slowly. It could take up to say 500-1000 milliseconds. Certainly not instantly.

                  他们会以弯曲的方式移动鼠标/光标.不仅仅是100%的直线.可能,以随机方式?那么可能需要一些随机性元素?

                  They would move the mouse/cursor in a curved fashion. Not just in a 100% straight line. Possibly, in a random fashion? So some elements of randomness may be needed?

                  我对 Selenium 还是很陌生,因此我们将不胜感激.

                  I'm quite new to Selenium, so any input would be greatly appreciated.

                  我正在用 Java 编写代码 :)

                  I am writing my code in Java :)

                  推荐答案

                  WebDriver 不使用操作系统输入;它通过http协议直接与浏览器通信.如果您想模拟像真实"鼠标输入一样的通信,您必须使用使用基于操作系统的框架的自动化解决方案.如果是 Windows,您可以使用例如:

                  WebDriver doesn't use an operating system input; it communicates directly with the browser via http protocol. If you want to simulate communication like a 'real' mouse input you have to use an automation solution that uses operating system based frameworks. In case of Windows you can use e.g.:

                  1. https://github.com/FlaUI/FlaUI(阅读https://github.com/FlaUI/FlaUI/wiki/FAQ 了解如何将 Chrome 配置为为 FlaUI 公开 Web 控件)
                  2. https://github.com/microsoft/WinAppDriver
                  1. https://github.com/FlaUI/FlaUI (read https://github.com/FlaUI/FlaUI/wiki/FAQ to get the knowledge how to configure Chrome to expose web controls for FlaUI)
                  2. https://github.com/microsoft/WinAppDriver

                  这篇关于Selenium WebDriver/Java - 模拟人类光标移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Selenium - chrome 驱动程序无法在后台启动(没有启动 下一篇:“java.lang.module.InvalidModuleDescriptorException:提供程序

                  相关文章

                  最新文章

                  <tfoot id='QUyhK'></tfoot>
                    <i id='QUyhK'><tr id='QUyhK'><dt id='QUyhK'><q id='QUyhK'><span id='QUyhK'><b id='QUyhK'><form id='QUyhK'><ins id='QUyhK'></ins><ul id='QUyhK'></ul><sub id='QUyhK'></sub></form><legend id='QUyhK'></legend><bdo id='QUyhK'><pre id='QUyhK'><center id='QUyhK'></center></pre></bdo></b><th id='QUyhK'></th></span></q></dt></tr></i><div id='QUyhK'><tfoot id='QUyhK'></tfoot><dl id='QUyhK'><fieldset id='QUyhK'></fieldset></dl></div>
                    <legend id='QUyhK'><style id='QUyhK'><dir id='QUyhK'><q id='QUyhK'></q></dir></style></legend>

                    <small id='QUyhK'></small><noframes id='QUyhK'>

                      • <bdo id='QUyhK'></bdo><ul id='QUyhK'></ul>