首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法单击“保存”并关闭标签

无法单击“保存”并关闭标签
EN

Stack Overflow用户
提问于 2017-06-14 21:10:03
回答 1查看 161关注 0票数 0

请帮助为什么不能点击保存和关闭图片下面?它显示错误,没有这样的元素。

代码语言:javascript
复制
action.MoveToElement(driver.FindElement(By.XPath("//*[@class='ms-crm-Menu-Label']"))).Click().Build().Perform();
driver.FindElement(By.XPath("//*[@class='ms-crm-ImageStrip-Save_16 ms-crm-commandbar-image16by16']/img")).Click();

这是HTML。

代码语言:javascript
复制
<li tabindex="-1"
title="Save &amp; Close (ALT+S) &#10;&#10;Save and close this Lead."
class="ms-crm-CommandBarItem ms-crm-CommandBar-Menu ms-crm-CommandBar-Button"
id="lead|NoRelationship|Form|Mscrm.Form.lead.SaveAndClose" style="display: inline-block; white-space: pre-line;"
command="lead|NoRelationship|Form|Mscrm.SaveAndClosePrimary">
<span tabindex="-1" class="ms-crm-CommandBar-Button ms-crm-Menu-Label"
    style="max-width: 200px;">
    <a tabindex="0" class="ms-crm-Menu-Label" onclick="return false">
        <img tabindex="-1"
            class="ms-crm-ImageStrip-SaveAndClose_16 ms-crm-commandbar-image16by16"
            style="vertical-align: top;" src="/_imgs/imagestrips/transparent_spacer.gif"></img>
        <span tabindex="-1" class="ms-crm-CommandBar-Menu" style="max-width: 150px;"
            command="lead|NoRelationship|Form|Mscrm.SaveAndClosePrimary"> Save &amp; Close </span>
        <div class="ms-crm-div-NotVisible"> Save and close this Lead. </div>
    </a>
</span>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-06-15 04:05:20

Webdriver无法使用您使用的xpath来定位控件。尝试以下几个方面:

代码语言:javascript
复制
driver.FindElement(By.XPath("//li/span/a[@class='ms-crm-Menu-Label']/span[@command='lead|NoRelationship|Form|Mscrm.SaveAndClosePrimary']")).Click();

让我知道它是否适合你。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44554791

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档