1. <legend id='XHV7M'><style id='XHV7M'><dir id='XHV7M'><q id='XHV7M'></q></dir></style></legend>

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

      <bdo id='XHV7M'></bdo><ul id='XHV7M'></ul>
  3. <tfoot id='XHV7M'></tfoot>

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

      Selenium WebDriver / Java - Simulate Human Like Cursor Movement(Selenium WebDriver/Java - 模拟人类光标移动)
      <legend id='Q9VJe'><style id='Q9VJe'><dir id='Q9VJe'><q id='Q9VJe'></q></dir></style></legend>
        • <bdo id='Q9VJe'></bdo><ul id='Q9VJe'></ul>

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

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

            <tbody id='Q9VJe'></tbody>

                <tfoot id='Q9VJe'></tfoot>
                本文介绍了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 - 模拟人类光标移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                <i id='93uNk'><tr id='93uNk'><dt id='93uNk'><q id='93uNk'><span id='93uNk'><b id='93uNk'><form id='93uNk'><ins id='93uNk'></ins><ul id='93uNk'></ul><sub id='93uNk'></sub></form><legend id='93uNk'></legend><bdo id='93uNk'><pre id='93uNk'><center id='93uNk'></center></pre></bdo></b><th id='93uNk'></th></span></q></dt></tr></i><div id='93uNk'><tfoot id='93uNk'></tfoot><dl id='93uNk'><fieldset id='93uNk'></fieldset></dl></div>
                <tfoot id='93uNk'></tfoot>

                  <tbody id='93uNk'></tbody>

                    1. <legend id='93uNk'><style id='93uNk'><dir id='93uNk'><q id='93uNk'></q></dir></style></legend>
                        • <bdo id='93uNk'></bdo><ul id='93uNk'></ul>

                          <small id='93uNk'></small><noframes id='93uNk'>