使用量角器拖放动态创建的Web元素

时间:2018-07-24 10:36:54

标签: selenium-webdriver drag-and-drop protractor

[在此处输入链接说明] [1]我想拖放一个元素... 我发现只需单击并按住该元素,即可创建新元素(draggable = true),而旧元素将获得 style:“ display = none”

所以现在我要拖放新创建的元素。

如何拖动新创建的元素...

尝试以下代码

 browser.actions().dragAndDrop(source,dest).mouseUp().perform();

HTML代码

<===========Before click and hold==================>

<li _ngcontent-c35="" class="list-group-item pr-0 pt-0 pb-1 sortable-item ng-star-inserted" is-attributelist-attribute="true" attributename="MANUFACTURER"><div _ngcontent-c35="" class="position-relative pr-4 mm-attr-item"><i _ngcontent-c35="" class="position-absolute drag-icon"><mm-icon _ngcontent-c35="" ng-reflect-icon-name="GrabTexture">MANUFACTURER</li>

<==================After click and hold====================>

<li _ngcontent-c35="" class="list-group-item pr-0 pt-0 pb-1 sortable-item ng-star-inserted" is-attributelist-attribute="true" attributename="MANUFACTURER" style="display:none;"><div _ngcontent-c35="" class="position-relative pr-4 mm-attr-item"><i _ngcontent-c35="" class="position-absolute drag-icon"><mm-icon _ngcontent-c35="" ng-reflect-icon-name="GrabTexture">MANUFACTURER</li>

<li _ngcontent-c35="" class="list-group-item pr-0 pt-0 pb-1 sortable-item ng-star-inserted sortable-chosen sortable-ghost" is-attributelist-attribute="true" attributename="MANUFACTURER" draggable="true"><div _ngcontent-c35="" class="position-relative pr-4 mm-attr-item"><i _ngcontent-c35="" class="position-absolute drag-icon"><mm-icon _ngcontent-c35="" ng-reflect-icon-name="GrabTexture">MANUFACTURER</li>

0 个答案:

没有答案