title: Custom Ribbon Button not Executing by Selenium Webdriver
body: <p>I am writing one automation script in this i am unable to click on a Custom RIbbon MSCRM2011 Button
  Below is HTML structure </p>
  
  <pre><code>&lt;li id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData" class="ms-cui-group" unselectable="on"&gt;
  &lt;span class="ms-cui-groupContainer" unselectable="on"&gt;
  &lt;span class="ms-cui-groupBody" unselectable="on"&gt;
  &lt;span id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData-LargeMedium" class="ms-cui-layout" unselectable="on"&gt;
  &lt;span id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData-LargeMedium-0" class="ms-cui-section" unselectable="on"&gt;
  &lt;span id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData-LargeMedium-1" class="ms-cui-section" unselectable="on"&gt;
  &lt;span id="contact|NoRelationship|Form|Mscrm.Form.contact.MainTab.ExportData-LargeMedium-1-0" class="ms-cui-row" unselectable="on"&gt;
  &lt;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"&gt;
  &lt;span class="ms-cui-ctl-iconContainer" unselectable="on"&gt;
  &lt;span class=" ms-cui-img-16by16 ms-cui-img-cont-float" unselectable="on"&gt;
  &lt;img unselectable="on" alt="" src="/%7B635732422790004376%7D/WebResources/fmc_/Images/HP.FMC.MSS360.CRM.Image.UpdateCustomer16X16"&gt;
  &lt;/span&gt;
  &lt;/span&gt;
  &lt;span class="ms-cui-ctl-mediumlabel" unselectable="on"&gt;Update Customer&lt;/span&gt;
  &lt;/a&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>I got Below Exception</p>
  
  <pre><code>  org.openqa.selenium.WebDriverException: [JavaScript Error: "a is null" {file: "file:///C:/Users/kumarahi/AppData/Local/Temp/anonymous6568124592565267980webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js" line: 8166}]'[JavaScript Error: "a is null" {file: "file:///C:/Users/kumarahi/AppData/Local/Temp/anonymous6568124592565267980webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js" line: 8166}]' when calling method: [nsICommandProcessor::execute]
  Command duration or timeout: 47 milliseconds
  Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'
  System info: host: 'KUMARAHI5', ip: '16.185.238.72', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_79'
  Session ID: 279f8847-4a64-4d6c-9ac9-9d703cc8faf4
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, browserConnectionEnabled=true, webStorageEnabled=true, nativeEvents=false, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=29.0}]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:348)
      at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:445)
      at org.openqa.selenium.By$ByXPath.findElement(By.java:357)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:340)
      at Ford_contact2.testWebdriverContact(Ford_contact2.java:117)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  </code></pre>
  
  <p>for Button I have Written Some set of lines but none of the line is working</p>
  
  <pre><code>    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();
  </code></pre>