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

        <bdo id='uKqBE'></bdo><ul id='uKqBE'></ul>

    2. <small id='uKqBE'></small><noframes id='uKqBE'>

    3. <legend id='uKqBE'><style id='uKqBE'><dir id='uKqBE'><q id='uKqBE'></q></dir></style></legend>
      <tfoot id='uKqBE'></tfoot>

        使用 Selenium 和 C# 在 draggable=true 时拖放不工作

        时间:2023-08-25
      1. <legend id='TRJwT'><style id='TRJwT'><dir id='TRJwT'><q id='TRJwT'></q></dir></style></legend>

            <tfoot id='TRJwT'></tfoot>
            • <small id='TRJwT'></small><noframes id='TRJwT'>

                <bdo id='TRJwT'></bdo><ul id='TRJwT'></ul>

                    <tbody id='TRJwT'></tbody>

                  <i id='TRJwT'><tr id='TRJwT'><dt id='TRJwT'><q id='TRJwT'><span id='TRJwT'><b id='TRJwT'><form id='TRJwT'><ins id='TRJwT'></ins><ul id='TRJwT'></ul><sub id='TRJwT'></sub></form><legend id='TRJwT'></legend><bdo id='TRJwT'><pre id='TRJwT'><center id='TRJwT'></center></pre></bdo></b><th id='TRJwT'></th></span></q></dt></tr></i><div id='TRJwT'><tfoot id='TRJwT'></tfoot><dl id='TRJwT'><fieldset id='TRJwT'></fieldset></dl></div>
                  本文介绍了使用 Selenium 和 C# 在 draggable=true 时拖放不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  元素被正确识别,我可以看到鼠标在这两个元素之间移动,但没有发生拖放.单击并按住时,UI 未显示任何突出显示.也没有错误.

                  Elements are identified correctly and i can see mouse moving between this two elements but drag and drop not happening. Ui not displayed any highlights when click and hold. No errors also.

                  我尝试了在不同讨论中提出的不同解决方案,但它们都不适合我

                  I have tried different solutions suggested on different discussions none of them working for me

                  我的代码

                  _actions = new Actions(Driver.WebDriver);
                          var dragAndDrop = _actions.ClickAndHold(parentRow)
                                                    .MoveToElement(childRow )
                                                    .Release(target)
                                                    .Build();
                          dragAndDrop.Perform();
                          Driver.Wait();
                  

                  这就是我识别元素的方式

                  This is how i am identifying elements

                   var childList =Driver.WebDriver.FindElements(By.ClassName("itl-treeNode-title"));
                       var parentRow = childList.FirstOrDefault(x => x.Text.Equals(parentSrc)).FindElement(By.XPath("following-sibling::*[1]"));
                       var childRow = childList.FirstOrDefault(x => x.Text.Equals(childSrc)).FindElement(By.XPath("following-sibling::*[1]"));
                  

                  相同的代码可以在我们应用程序的另一个用户界面上运行.

                  Same code works on another ui on our application.

                  我现在已经像下面这样更改了我的代码,现在我得到了陈旧的元素异常——因为我需要动态识别这个元素,所以我不能使用这里提到的 POM 解决方案 https://www.softwaretestingmaterial.com/stale-element-reference-exception-selenium-webdriver/#How-To-Overcome-Stale-Element-Reference-Exception-in-Selenium

                  I have now changed my code like below and now i am getting stale element exception- Since i need to identify this element dynamically i can not use the POM solution mentioned here https://www.softwaretestingmaterial.com/stale-element-reference-exception-selenium-webdriver/#How-To-Overcome-Stale-Element-Reference-Exception-in-Selenium

                  var childList = Driver.WebDriver.FindElements(By.ClassName("itl-treeNode-title"));
                       var parent = childList.FirstOrDefault(x => x.Text.Equals(parentSrc)).FindElement(By.XPath("parent::*"));
                       var parentRow = parent.FindElement(By.ClassName("itl-treenode-content-cover"));
                       var child = childList.FirstOrDefault(x => x.Text.Equals(childSrc)).FindElement(By.XPath("parent::*"));
                       var childRow = child.FindElement(By.ClassName("itl-treenode-content-cover"));         
                       childRow.Click();
                       //try
                       //{
                       //   (new Actions(Driver.WebDriver)).DragAndDrop(childRow, parent).Perform();
                       /

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

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