javafx-webengine

Is it possible to retrieve HTML element in web engine without using Javascript?

余生长醉 提交于 2020-01-02 08:10:09
问题 Is there a way to identify the type of the clicked element in webView (like Textbox/Radio/Button etc) using the webEngine.getDocument() ? Suppose I click on a textfield, I can get the x,y coordinates of the clicked position. Is it possible to identify the element present in that particular location? Something like the document.elementFromPoint() method in Javascript. I can do it using Jquery/Javascript. But since we have access to Document object and its elements, is there a way to identify

JavaFX WebEngine stuck in “Running” state

血红的双手。 提交于 2020-01-02 03:50:28
问题 While using the WebEngine in JavaFX2, I've noticed it sometimes just gets stuck. Assume I were making a crawler that simply finds hyperlinks on a page and then visits them to do the same recursively, keeping track of which links we have visited and which are already on the frontier. While running my code, the execution would sometimes hang at arbitrary moments. I've added some debug code to my project in the form of listeners to the workDoneProperty and exceptionProperty and by printing every

How to debug problems with the javafx native bundle for Windows?

ぃ、小莉子 提交于 2019-12-24 02:39:16
问题 I'm trying to package a JavaFX/DukeScript application into native bundles. For Windows that's achieved with Inno Setup, that's what the javafxpackager uses. I can't find much documentation about it, so I'll create a question and provide the answers I find below. Related questions: 1, 2, 3, 4 回答1: So I've created a build.xml Ant script using e(fx)clipse (see example here). I've been following this excellent blog post. Now, the bundle task worked and produced an installer and executable app. I

How can I set a JavaFX WebView as big as the scene?

前提是你 提交于 2019-12-20 01:41:45
问题 I have a JavaFX WebView which I want to have as big as the scene on start. If I could make it resize with the scene, this would be perfect. But right now I focus just on the initial size. @Override public void start(Stage stage) { try { Scene scene = new Scene(createWebViewPane(), 1920, 1080); scene.getStylesheets().add(getClass().getResource("Styles/application.css").toExternalForm()); stage.setScene(scene); stage.show(); } catch (Exception e) { e.printStackTrace(); } } The above code

JavaFx WebEngine - Overwriting a website's stylesheet with (local) files

一笑奈何 提交于 2019-12-18 07:18:54
问题 I'd like to customise the appearance of a website that I am loading, so I created a little test.css file that does nothing but changing the look of all table rows: tr { height: 22px; background-image: url("test.png"); } How do I get he WebEngine to load this file and replace the page's own CSS rules with mine? Also, i'd like to be able to load page-specific css files and not one huge file for all pages. I found this page, but it only shows how to run through the DOM and assign a new style to

JavaFX WebView can't load certain sites

拥有回忆 提交于 2019-12-18 04:22:05
问题 I'm trying to use JavaFX's WebView to load this site, but all I get is a blank screen. The WebView is working perfectly fine on other sites; it gets 100/100 on ACID3 and loads other HTTPS sites without any problems whatsoever. I can't find anything particularly wrong with the site either. It has a proper, non-expired certificate signed by proper CA, and SSL Labs report a B grade. I tried all the major browsers on it and none report any certificate or SSL related issues; the site renders fine

How to catch return value from javascript in javafx?

我们两清 提交于 2019-12-17 20:43:35
问题 I am executing a javascript code in my webview of JavaFX application. I need to make it execute repeatedly whenever there is a mouse click and get the element details into a java variable. I'm using the below code and using Firebug Lite. In Firebug console, required items are printing. But I want it returned to java application. engine.documentProperty().addListener(new ChangeListener<Document>() { @Override public void changed(ObservableValue<? extends Document> prop, Document oldDoc,

How can I work around YouTube API embed restrictions like other websites?

好久不见. 提交于 2019-12-17 16:43:23
问题 I am building a java program that has the option to play YouTube videos in an embedded player. The problem is that most of the music videos won't play and I get the following error: "This video contains content from (Media Corporation Name) . It is restricted from playback on certain sites." I tried loading the same URL in Chrome and got the same results. https://www.youtube.com/embed/TMZi25Pq3T8 However, after some research, I quickly got it fixed by installing a Chrome Extension that allows

Changing JavaFX label using Javascript callback method

可紊 提交于 2019-12-13 05:25:43
问题 This question might be considered as a simple extension to this qeustionI have a simple application with a label and a WebView. The WebView contains a small rectangle whose onclick should invoke a method in JavaFX and change the text of a label. Following is my FXML file <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.web.*?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <AnchorPane id=

How to update new tab title?

社会主义新天地 提交于 2019-12-12 04:19:51
问题 I'm trying to build a web browser in java swing where i added new tab option by adding JTabbedPane . But i want to update my current tab title when i browse another web page or urls etc. I used WebView and WebEngine as html parser. I tried to update title name using WebEngine.getTitle() it didn't work. Here is my constructor: public class Hello extends JFrame { private JButton backButton = new JButton(); private JButton newPage; private JButton forwardButton = new JButton(); private JFXPanel