I am new to JavaFX. I successfully uploaded the website to my JavaFX application. I would like to enter the site from my Java application. So far, I have been able to paste my input values into the corresponding input field, but I cannot figure out how to click the submit button. Can anybody help me. Here is what I still have.

Here is my controller class.
public class Controller implements Initializable{
@FXML
protected TextField usernameLogin;
@FXML
protected TextField passwordLogin;
@FXML
protected Button loginButton;
@FXML
protected WebView webviewBrowser;
@Override
public void initialize(URL location, ResourceBundle resources) {
final WebEngine engine = webviewBrowser.getEngine();
engine.load("http://gmail.com");
engine.setJavaScriptEnabled(true);
loginButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
String username = usernameLogin.getText().toString();
String password = passwordLogin.getText().toString();
engine.getDocument().getElementById("Email").setAttribute("Value", username);
engine.getDocument().getElementById("Passwd").setAttribute("Value", password);
}
});
}
}
Can someone help me. What should I do to send? Thank.
source
share