Currently, I am in the process of writing tests for a Java application that has been created with the Vaadin framework. To conduct these tests, I have opted to utilize the Robot Framework. In certain instances, I must implement robot framework commands such as execute javascript.
For instance, when locating a component, the following command is executed:
execute javascript document.getElementById('button-create').click()
This method works seamlessly. The use of primitives like Click Element
is ineffective due to Vaadin not waiting for the entire page to load resulting in some ids being unassigned at runtime.
Regrettably, the design of this specific application dictates that some components respond to the event click
, while others require the event mousedown
. When interacting with the Java console in Chrome, executing the following command proves successful:
document.getElementsByClassName('table-cell-wrapper')[1].mousedown();
producing the desired action without any issues. Unfortunately, attempting to carry out the same action within the robot framework environment yields an error:
execute javascript document.getElementsByClassName('table-cell-wrapper')[1].mousedown();
The error message encountered reads as follows:
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' ;
Therefore, the question arises... how can I successfully trigger the mousedown
event on a specific element using Javascript and Webdriver?
The current environment details are as follows:
RIDE 1.2.1 operating on Python 2.7.5.
Robot Framework 2.8.1
Library Selenium2Library
Library Screenshot
Library Dialogs
Library Collections
Thank you in advance.