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