title: Selenium Webdriver mousedown command
body: <p>I am writing tests for a Java application which has been developed using the Vaadin framework. For the tests I am using <strong>Robot Framework</strong>. At some steps I have to use robot framework commands like <strong>execute javascript</strong>. </p>
  
  <p>For example, for finding a component I have to execute the following command:</p>
  
  <pre><code>execute javascript    document.getElementById('button-create').click()
  </code></pre>
  
  <p>Which works without any problem. Primitives like <code>Click Element</code> are not working because Vaadin doesn't wait until the whole page is loaded and therefore some ids are not yet assigned at run time.</p>
  
  <p>Unfortunately this application has been developed in such a way that some components are not reacting to the event <code>click</code> but to the event <code>mousedown</code>. That is, at the Java console of chrome I can perform the following command:</p>
  
  <pre><code>    document.getElementsByClassName('table-cell-wrapper')[1].mousedown();
  </code></pre>
  
  <p>and the action is performed without any problem. So far so good. </p>
  
  <p>Unfortunately when trying to do the same at robot framework</p>
  
  <pre><code>    execute javascript    document.getElementsByClassName('table-cell-wrapper')[1].mousedown();
  </code></pre>
  
  <p>I am getting te following error:</p>
  
  <pre><code>Executing JavaScript:
  document.getElementsByClassName('table-cell-wrapper')[1].mousedown();
  20131029 12:22:12.445 :  INFO : &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;a href="selenium-    screenshot-1.png"&gt;&lt;img src="selenium-screenshot-1.png" width="800px"&gt;&lt;/a&gt;20131029 12:22:12.453 :  FAIL : 
  WebDriverException: Message: u'document.getElementsByClassName(...)[1].mousedown is not a function' ;
  </code></pre>
  
  <p>Then the question is... how can I trigger the event <code>mousedown</code> on a given element using Javascript and Webdriver.</p>
  
  <p>My environment is:</p>
  
  <pre><code>RIDE 1.2.1 running on Python 2.7.5. 
  Robot Framework 2.8.1
  Library           Selenium2Library
  Library           Screenshot
  Library           Dialogs
  Library           Collections
  </code></pre>
  
  <p>Thanks in advance.</p>