无法找到元素,这是在Salesforce Lightning中删除对象

时间:2018-09-03 05:55:43

标签: selenium-webdriver xpath salesforce domxpath

<div class="DESKTOP uiModal forceModal open active" data-aura-rendered-by="3706:0" data-aura-class="uiModal forceModal" aria-hidden="false" style="z-index: 1;"><div class="modal-glass slds-backdrop fadein slds-backdrop--open" tabindex="-1" data-aura-rendered-by="3707:0" style="opacity: 1;"></div><div class="panel slds-modal slds-fade-in-open" aria-labelledby="title_3694:0" tabindex="-1" role="dialog" aria-modal="true" data-aura-rendered-by="3708:0"><div class="modal-container slds-modal__container" data-aura-rendered-by="3709:0"><div class="modal-header slds-modal__header empty slds-modal__header--empty" data-aura-rendered-by="3710:0"><!--render facet: 3711:0--><!--render facet: 3712:0--><!--render facet: 3713:0--><button class="slds-button slds-modal__close closeIcon slds-button_icon-bare slds-button_icon-inverse" type="button" title="Close this window" data-aura-rendered-by="3698:0"><lightning-primitive-icon data-aura-rendered-by="3699:0" lightning-primitive-icon_primitive-icon=""><svg focusable="false" data-key="close" aria-hidden="true" class="slds-button__icon slds-button__icon_large slds-button_icon-inverse" lightning-primitive-icon_primitive-icon="">
<use xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.8.0#close" lightning-primitive-icon_primitive-icon=""></use>
</svg></lightning-primitive-icon><span class="slds-assistive-text" data-aura-rendered-by="3701:0">Close this window</span></button></div><div class="modal-body scrollable slds-modal__content slds-p-around--medium" data-aura-rendered-by="3716:0" data-scoped-scroll="true"><!--render facet: 3703:0--><div data-aura-rendered-by="3664:0" class="objectManagerCustomObjectDeleteWarning" data-aura-class="objectManagerCustomObjectDeleteWarning"><p data-aura-rendered-by="3665:0">Deleting a custom object does the following:</p><ul data-aura-rendered-by="3667:0"><li data-aura-rendered-by="3668:0">Deletes all the data that currently exists in all records of that custom object</li><li data-aura-rendered-by="3670:0">Deletes all tracked history data associated with the custom object</li><li data-aura-rendered-by="3672:0">Deletes the custom tab and list views for the object</li><li data-aura-rendered-by="3674:0">Deletes workflow rules and actions that use the object</li><li data-aura-rendered-by="3676:0">Hides the custom object definition and all related definitions</li><li data-aura-rendered-by="3678:0">Hides the object's data records and all related data records</li><li data-aura-rendered-by="3680:0">Disables report types for which this is the main object</li><li data-aura-rendered-by="3682:0">Disables custom reports for which this is the main object</li><li data-aura-rendered-by="3684:0">Deactivates custom formula fields on the object</li><li data-aura-rendered-by="3686:0">Deactivates custom validation rules and approval processes on the object</li><li data-aura-rendered-by="3688:0">Deactivates and deletes the Lightning Pages associated with the custom object.</li></ul><p data-aura-rendered-by="3690:0">In order to preserve a record of data for future reference, run a data export before deleting custom objects by clicking Data | Data Export.</p><p data-aura-rendered-by="3692:0">After you've deleted this custom object, it appears in the deleted objects list for 15 days. During that time, you can either undelete it to restore it and all the data stored in it, or delete it permanently. When you undelete a custom object, some of its properties might be lost or changed.  After 15 days, the object and its data are permanently deleted.</p></div></div><div class="modal-footer slds-modal__footer" data-aura-rendered-by="3737:0"><div data-aura-rendered-by="3721:0" class="forceModalActionContainer--footerAction forceModalActionContainer" data-aura-class="forceModalActionContainer--footerAction forceModalActionContainer"><button class="slds-button slds-button--neutral uiButton--default uiButton--brand uiButton forceActionButton" aria-live="off" type="button" title="delete" data-aura-rendered-by="3728:0" data-aura-class="uiButton--default uiButton--brand uiButton forceActionButton"><!--render facet: 3729:0--><span class=" label bBody" dir="ltr" data-aura-rendered-by="3731:0">Delete</span><!--render facet: 3726:0--></button></div></div></div></div></div>

我尝试使用此xpath定位元素:

//div[contains(@class,'modal-container slds-modal__container')]//div[3]//div//button[1]//span[1]

但是硒无法找到它,所以有人可以帮我吗?我想点击删除按钮。

1 个答案:

答案 0 :(得分:0)

看起来像在您的html中具有xlink:href命名空间的html中定义名称空间或删除xlink的名称空间:

更新此命名空间: xmlns:xlink="http://www.w3.org/2001/XLINK"

输入中的

命名空间:<use xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.8.0#close" lightning-primitive-icon_primitive-icon=""/>