简体   繁体   中英

Java Application - Load web page and check user selections in DOM

I want to build a Java application through which a user can request a web page, which loads in inside the Java application (not in a browser). After the page loads, the user can select whichever elements they like on the page, and I want to track which elements they click through the DOM.

IE the user clicks the image of a product, then I want to get that particular element of the DOM, with all the attributes such as src, class, id, etc.

I'd like to know if any frameworks get close to doing anything like this. Especially the clicked elements, since the web page I am pretty sure there are quite a few ways to load in inside a Java application.

I don't know if this is what you have in mind, but you can try to take a look at HtmlUnit http://htmlunit.sourceforge.net/gettingStarted.html . It is said that it is used for unit tests, but it can be used also for other purposes; one of the descriptions I found is:

"A java GUI-Less browser, which allows high-level manipulation of web pages, such as filling forms and clicking links; just getPage(url), find a hyperlink, click() and you have all the HTML, JavaScript, and Ajax are automatically processed."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM