Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium webdriver 无法单击“保存并关闭标签”_Selenium Webdriver - Fatal编程技术网

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

Selenium webdriver 无法单击“保存并关闭标签”,selenium-webdriver,Selenium Webdriver,请帮助为什么不能点击保存并关闭下面的图片?它显示错误,没有这样的元素 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

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

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

<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>
  • 储蓄及;接近 保存并关闭此潜在客户。

  • Webdriver无法使用您使用的xpath定位控件。请尝试以下操作:

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

    让我知道它是否适合您。

    Save&;关闭保存并关闭此潜在客户。***Selenium IDE源代码:单击css=img.ms-crm-ImageStrip-SaveAndClose_16.ms-crm-commandbar-images16by16您的代码非常好学,但很抱歉仍然无法使用。请提供进一步的帮助。其中没有一个对我有用…cry//driver.FindElement(By.XPath(“//*[@class='ms-crm-Menu-Label']]/img[@class='ms-crm-ImageStrip-Save_16 ms-crm-commandbar-images16by16'])。单击()//FindElement(By.XPath(//span[@class='ms-crm-CommandBar-Button ms crm菜单标签悬停']]/a[@class='ms-crm-Menu-Label']]/span[@class='ms-crm-CommandBar-Menu']])。单击()//FindElement(By.XPath(“//li/span/a/span[contains(Text(),'Save&Close')]”),单击();Mahipal,请发电子邮件给我“btcanada2008@yahoo.com“我会向您展示HTML标记的详细信息。我试了很多方法,但都不管用。请帮助。您遇到了什么错误?您可以共享异常跟踪吗?结果消息:测试方法NewUnitTestProject.CheckInteractionStatus.ChangeAndCheckInteractionStatus引发异常:OpenQA.Selenium.NoSuchElementException:找不到xpath=/*[@class='ms-crm-Menu-Label']/span[@command='lead | NoRelationship | Form | Mscrm.SaveAndClosePrimary']