在Java中嵌入式/无头浏览器,支持自定义DOM事件或注射的javascript [英] Embedded/Headless browser in Java that supports custom DOM events or injecting javascript

查看:1946
本文介绍了在Java中嵌入式/无头浏览器,支持自定义DOM事件或注射的javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用某种类型的web浏览器对象在Java中,导航至某个Ajax页面以及

I want to use some kind of webbrowser object in java to navigate to an Ajax page and

(一)添加一个侦听器触发每次HTML是由服务器动态地改变时DOM元素

(a) add a listener to a DOM element that fires every time the HTML is changed dynamically by the server

(二)的Javascript注入到DOM火的自定义事件,或通过外部接口或一些调用Java方法。

(b) inject Javascript into the DOM to fire a custom event or call a Java method via an external interface or something.

在组件的任何建议,可以这样做吗? ,仅仅显示正在导航到该页面并捕获用户点击事件的任何成分是不行的,很遗憾。

Any suggestions on components that might do this, please? Any component that merely displays the page being navigated to and captures user click event is no good, unfortunately.

我需要触发事件时,在DOM变化的HTML。 。

I need to fire events when the HTML in the DOM changes. .

感谢。

推荐答案

您可以签出SWTBrowser组件。它可以嵌入一个SWT组件中(因此使用Java访问),并让你注入Javascript和做别的。

You can checkout the SWTBrowser component. It can be embedded within a SWT component (and hence accessed using Java) and lets you inject Javascript and do anything else.

<一个href=\"http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fswt%2Fbrowser%2Fpackage-summary.html\" rel=\"nofollow\">http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fswt%2Fbrowser%2Fpackage-summary.html这个讲座。

这篇关于在Java中嵌入式/无头浏览器,支持自定义DOM事件或注射的javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆