【发布时间】:2019-02-09 13:32:33
【问题描述】:
这是一个 Salesforce 亮化页面,在删除对象时,我得到一个模式对话框,我无法移动以单击它。警报类无法移动到页面上。
请在下面找到代码:
public static void Delete_Object(WebDriver driver) throws InterruptedException
{
// (new WebDriverWait(driver, 30)).until(ExpectedConditions.elementToBeClickable(By.xpath(("//label[contains(@for,'globalQuickfind')]/preceding::div/input[contains(@id,'globalQuickfind')]")))).sendKeys("java dev");
try
{
(new WebDriverWait(driver, 30)).until(ExpectedConditions.elementToBeClickable(By.xpath(("//span[.='Java_dev__c']//following::td[5]//a")))).click();
(new WebDriverWait(driver, 30)).until(ExpectedConditions.elementToBeClickable(By.xpath(("//span[.='Delete']//span")))).click();
Thread.sleep(5000);
(new WebDriverWait(driver, 30)).until(ExpectedConditions.elementToBeClickable(By.xpath(("//button[@title=\"Close this window\"]")))).click();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
这里是html代码:
<div class="panel slds-modal slds-fade-in-open" aria-labelledby="title_4828:0" tabindex="-1" role="dialog" aria-modal="true" data-aura-rendered-by="4842:0">
<div class="modal-container slds-modal__container" data-aura-rendered-by="4843:0">
<div class="modal-header slds-modal__header empty slds-modal__header--empty" data-aura-rendered-by="4844:0">
<!--render facet: 4845:0--><!--render facet: 4846:0--><!--render facet: 4847: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="4832:0">
<lightning-primitive-icon data-aura-rendered-by="4833: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="4835:0">Close this window</span>
</button>
</div>
<div class="modal-body scrollable slds-modal__content slds-p-around--medium" data-aura-rendered-by="4850:0" data-scoped-scroll="true">
<!--render facet: 4837:0-->
<div data-aura-rendered-by="4798:0" class="objectManagerCustomObjectDeleteWarning" data-aura-class="objectManagerCustomObjectDeleteWarning">
<p data-aura-rendered-by="4799:0">Deleting a custom object does the following:</p>
<ul data-aura-rendered-by="4801:0">
<li data-aura-rendered-by="4802:0">Deletes all the data that currently exists in all records of that custom object</li>
<li data-aura-rendered-by="4804:0">Deletes all tracked history data associated with the custom object</li>
<li data-aura-rendered-by="4806:0">Deletes the custom tab and list views for the object</li>
<li data-aura-rendered-by="4808:0">Deletes workflow rules and actions that use the object</li>
<li data-aura-rendered-by="4810:0">Hides the custom object definition and all related definitions</li>
<li data-aura-rendered-by="4812:0">Hides the object's data records and all related data records</li>
<li data-aura-rendered-by="4814:0">Disables report types for which this is the main object</li>
<li data-aura-rendered-by="4816:0">Disables custom reports for which this is the main object</li>
<li data-aura-rendered-by="4818:0">Deactivates custom formula fields on the object</li>
<li data-aura-rendered-by="4820:0">Deactivates custom validation rules and approval processes on the object</li>
<li data-aura-rendered-by="4822:0">Deactivates and deletes the Lightning Pages associated with the custom object.</li>
</ul>
<p data-aura-rendered-by="4824: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="4826: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="4871:0">
<div data-aura-rendered-by="4855: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="4862:0" data-aura-class="uiButton--default uiButton--brand uiButton forceActionButton">
<!--render facet: 4863:0--><span class=" label bBody" dir="ltr" data-aura-rendered-by="4865:0">Delete</span><!--render facet: 4860:0-->
</button>
</div>
</div>
</div>
</div>
请查看附件截图:
【问题讨论】:
-
以文本格式粘贴 HTML。
-
当你有文本输出时,don't take a picture but copy paste the output in your POST 也可以右键复制html -> 复制为outerHTML。
-
你可以在截图中看到@cruisepandey
-
不,需要div的innerHTML
-
@AnuragShrivastava :除非必要,否则发布图片绝不是一件好事。以文本格式共享 HTML 代码。以便我们更有效地帮助您。
标签: selenium selenium-webdriver xpath salesforce