Is it possible to modify html elements using the ScriptEngine or WebEngine classes from Java? I've tried the following:
/* theSite is a WebEngine object. Assume the id 'Email' is correct */
Element email=(Element) theSite.executeScript("document.getElementById('Email');");
email.setAttribute( "value", "navon.josh" );
I saw something like this in an example, but it didn't seem to work. I also tried this:
final ScriptEngineManager manager = new ScriptEngineManager();
final ScriptEngine engine = manager.getEngineByName( "js" );
try {
engine.eval( "document.getElementById( 'Email' ).value = 'navon.josh'" );
} catch( ScriptException e) {
e.printStackTrace();
}
This also didn't work. Is it because the statement isn't linked to the WebEngine?