Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.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
Html Selenium Webdriver未执行自定义功能区按钮_Html_Selenium_Xpath_Selenium Webdriver_Dynamics Crm - Fatal编程技术网

Html Selenium Webdriver未执行自定义功能区按钮

Html Selenium Webdriver未执行自定义功能区按钮,html,selenium,xpath,selenium-webdriver,dynamics-crm,Html,Selenium,Xpath,Selenium Webdriver,Dynamics Crm,我正在编写一个自动化脚本,我无法单击自定义功能区MSCRM2011按钮 下面是HTML结构 <li id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData" class="ms-cui-group" unselectable="on"> <span class="ms-cui-groupContainer" unselectable="on"> <span class="ms-cui

我正在编写一个自动化脚本,我无法单击自定义功能区MSCRM2011按钮 下面是HTML结构

<li id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData" class="ms-cui-group" unselectable="on">
<span class="ms-cui-groupContainer" unselectable="on">
<span class="ms-cui-groupBody" unselectable="on">
<span id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData-LargeMedium" class="ms-cui-layout" unselectable="on">
<span id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData-LargeMedium-0" class="ms-cui-section" unselectable="on">
<span id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData-LargeMedium-1" class="ms-cui-section" unselectable="on">
<span id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData-LargeMedium-1-0" class="ms-cui-row" unselectable="on">
<a id="contact|NoRelationship|Form|fmc.contact.form.Button.Customer-Medium" class="ms-cui-ctl-medium " unselectable="on" href="javascript:;" onclick="return false;" aria-describedby="contact|NoRelationship|Form|fmc.contact.form.Button.Customer_ToolTip" mscui:controltype="Button" role="button">
<span class="ms-cui-ctl-iconContainer" unselectable="on">
<span class=" ms-cui-img-16by16 ms-cui-img-cont-float" unselectable="on">
<img unselectable="on" alt="" src="/%7B635732422790004376%7D/WebResources/fmc_/Images/HP.FMC.MSS360.CRM.Image.UpdateCustomer16X16">
</span>
</span>
<span class="ms-cui-ctl-mediumlabel" unselectable="on">Update Customer</span>
</a>
</span>
对于Button,我已经写了一些行,但没有一行是有效的

    driver.findElement(By.cssSelector("%7B635731557200004376%7D/WebResources/fmc_/Images/HP.FMC.MSS360.CRM.Image.UpdateCustomer16X16"));
 driver.findElement(By.cssSelector("img.ms-crm-ImageStrip-SaveAndClose_32")).click();
 driver.findElement(By.cssSelector("span. ms-cui-img-16by16 ms-cui-img-cont-float")).click();
 driver.findElement(By.cssSelector("a.ms-cui-ctl-medium ")).click();
     driver.findElement(By.xpath("//*[@id='contact|NoRelationship|Form|fmc.contact.form.Button.Customer-Medium']/span[1]/span/img']")).click();

你能不能不用这个:

driver
    .findElement(By.id("contact|NoRelationship|Form|fmc.contact.form.Button.Customer-Medium"))
    .click();

或者使用xpath://span[contains(text(),'updatecustomer')]谢谢。下面的代码行工作。。。driver.findElement(By.id(“contact | norrelationship | Form | fmc.contact.Form.Button.Customer Medium”)。单击();
driver
    .findElement(By.id("contact|NoRelationship|Form|fmc.contact.form.Button.Customer-Medium"))
    .click();