I need to trigger the following custom DOM event
const event = new CustomEvent('GTWEvent', {
detail: { command: 'REQACCT' }
});
window.dispatchEvent(event);
Once I dispatch the above DOM event, I will receive a "CDMEvent" in response, which will contain attributes such as account, type, etc. I need to consume this DOM event and process the data.
Note: Need to write code in java, i am working on eclipse RCP(JXBrowser)
I have tried many ways using
jxbrowser.getBrowser().mainFrame().get().executeJavaScript("const event = new
CustomEvent('GTWEvent', {
detail: { command: 'REQACCT' }
});
window.dispatchEvent(event);")
I need to trigger the following custom DOM event
const event = new CustomEvent('GTWEvent', {
detail: { command: 'REQACCT' }
});
window.dispatchEvent(event);
Once I dispatch the above DOM event, I will receive a "CDMEvent" in response, which will contain attributes such as account, type, etc. I need to consume this DOM event and process the data.
Note: Need to write code in java, i am working on eclipse RCP(JXBrowser)
I have tried many ways using
jxbrowser.getBrowser().mainFrame().get().executeJavaScript("const event = new
CustomEvent('GTWEvent', {
detail: { command: 'REQACCT' }
});
window.dispatchEvent(event);")
1 Answer
Reset to default 0Try using JxBrowser DOM API as shown in the code below:
browser.mainFrame().ifPresent(frame -> {
frame.document().ifPresent(document -> {
CustomEventParams eventParams =
CustomEventParams.newBuilder(document)
.detail("command: REQACCT")
.build();
CustomEvent event = document.createCustomEvent(
EventType.of("GTWEvent"), eventParams);
document.dispatch(event);
});
});