Within my Eclipse RCP application, I make use of the SWT Browser to display a web application. I've been able to automate the testing of the application using the "invoke evaluate" function to interact with the DOM elements (i.e. insert text, select buttons, etc.). However, I haven't been able to determine how to verify that the application worked. I am trying to return a DOM object in the ECL so I can inspect the object and verify that the application is working.
Here is my script where I am trying to assign the value to a variable:
with [get-view "Encoder View" | get-control Browser] {
get-object | invoke evaluate "document.getElementById('PDX').value;" | let [val obj -input] {
format "%s" $obj | show-alert
}
}
When I execute the script I get the error "Do not know how to box value of type 'org.eclipse.core.runtime.Status'". I'm not sure why the "evaluate" method is returning type "Status". According to the documentation, it should return "Object".
Is this possible? What am I missing?
UPDATE
I had 2 problems with my script above: 1) I was missing the "return" keyword in the javascript. 2) I was retrieving the incorrect element from the DOM. After I modified my script to add the return and select the correct element (radio button), the values are returned and stored in the ECL variable correctly.
Here is the updated example:
with [get-view "Encoder View" | get-control Browser] {
get-object | invoke evaluate "return document.getElementById('PDXRADIO').checked;" | let [val obj -input] {
format "%s" $obj | show-alert
}
}
The result of the evaluation is a 'org.eclipse.core.runtime.Status', which is an Object. No problem here.
However RCPTT (ECL to be specific) will try to box returned value into either an EObject or any of the boxed primitives it supports. See box() method at lines 143 and 152: