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

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

      2. Selenium - 元素不可点击

        时间:2023-09-03
              <tbody id='wUjFQ'></tbody>

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

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

                • <tfoot id='wUjFQ'></tfoot>
                  <legend id='wUjFQ'><style id='wUjFQ'><dir id='wUjFQ'><q id='wUjFQ'></q></dir></style></legend>

                  <i id='wUjFQ'><tr id='wUjFQ'><dt id='wUjFQ'><q id='wUjFQ'><span id='wUjFQ'><b id='wUjFQ'><form id='wUjFQ'><ins id='wUjFQ'></ins><ul id='wUjFQ'></ul><sub id='wUjFQ'></sub></form><legend id='wUjFQ'></legend><bdo id='wUjFQ'><pre id='wUjFQ'><center id='wUjFQ'></center></pre></bdo></b><th id='wUjFQ'></th></span></q></dt></tr></i><div id='wUjFQ'><tfoot id='wUjFQ'></tfoot><dl id='wUjFQ'><fieldset id='wUjFQ'></fieldset></dl></div>
                  本文介绍了Selenium - 元素不可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 selenium 作为测试脚本.我收到以下错误,并且此错误随机发生.当我跑 10 次时,我得到了大约两次.所以它不是真正可复制的.有谁知道为什么会这样?我尝试单击的元素在浏览器中绝对可见并且不会四处移动,因此无需调整大小或拖动元素.我正在使用 chrome webdriver 并阅读了其他故障排除策略(调试"元素无法点击"错误),它们似乎与我的问题无关.我也等了足够的时间.

                  I am using selenium for test script. I am getting following error and this error randomly occur. When I run 10 times, I get this about twice. So it's not really reproducible. Does anyone know why this is happening? the element I am trying to click is definitely visible in the browser and doesn't move around so there is no need to resize or drag element. I am using chrome webdriver and I read other troubleshooting strategies(Debugging "Element is not clickable at point" error) and they don't seem relevant to my issue. I waited enough time as well.

                  UnknownError: unknown error: Element is not clickable at point (167, 403). Other element would receive the click: <div class="leftMasterBackground"></div>
                  

                  推荐答案

                  您可以执行许多步骤来提高单击不同 UI 元素时的稳定性:

                  There are a number of steps you can do in order to improve the stability while clicking on different UI elements:

                  • 显式等待它在 DOM 中存在
                  • 滚动进入元素视图
                  • 检查是否可点击
                  • Explicitly wait for it's presence in the DOM
                  • Scroll into the element view
                  • Check if clickable

                  对稳定性有帮助吗?

                  WebDriverWait wait = new WebDriverWait(driver, 3)
                  JavascriptExecutor js = ((JavascriptExecutor) driver)
                  
                  //presence in DOM
                  wait.until(ExpectedConditions.presenceOfElement(By.id("ID")));
                  
                  //scrolling
                  WebElement element = driver.findElement(By.id("ID")));  
                  js.executeScript("arguments[0].scrollIntoView(true);", element);
                  
                  //clickable
                  wait.until(ExpectedConditions.elementToBeClickable(By.id("ID")));
                  

                  此外,如果您决定覆盖默认的 Actions 界面有更多自定义,您可以使用两种类型的点击(例如):click() 将具有所有这些稳定性步骤和 fastClick() 这将是没有任何变化的默认点击.

                  Further, if you will decide to override the default Actions interface with more customized one, you can use two type of clicks (for example): click() which will have all those stability steps and fastClick() which will be the default clicking without any varification.

                  这篇关于Selenium - 元素不可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Node.js 需要而不将其存储到变量中 下一篇:使用量角器从 chromedriver 获取 HTTP 请求(性能日志

                  相关文章

                  最新文章

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

                • <legend id='q9fKe'><style id='q9fKe'><dir id='q9fKe'><q id='q9fKe'></q></dir></style></legend>

                • <small id='q9fKe'></small><noframes id='q9fKe'>

                    • <bdo id='q9fKe'></bdo><ul id='q9fKe'></ul>
                  1. <tfoot id='q9fKe'></tfoot>