|
Re: swt browser class, how to get the value of the html controls [message #853748 is a reply to message #853702] |
Mon, 23 April 2012 09:47 |
|
You can use the following function to run JavaScript Code and then return the desired value in the JavaScript code.
help.eclipse.org/galileo/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/browser/Browser.html#evaluate(java.lang.String)
Object value = browser.evaluate("return document.getElementById('YOUR_CONTROLS_ID').value");
You are able to access everything via JavaScript and DOM.
You can also execute JavaScript methods/functions like
Object value = browser.evaluate("getACertainValue()");
As you can see in the JavaDoc of the evaluate method, the following types of objects can be mapped from JavaScript to an Java object:
javascript null or undefined -> null
javascript number -> java.lang.Double
javascript string -> java.lang.String
javascript boolean -> java.lang.Boolean
javascript array whose elements are all of supported types -> java.lang.Object[]
Best regards,
Simon
[Updated on: Mon, 23 April 2012 12:08] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03663 seconds