i have javafx ui type url , loads website in webview. there textfield specify xpath. if press "find" button, corresponding element has highlighted in web view. possible using javafx or javascript or jsoup?
find.setonaction(new eventhandler<actionevent>() { @override public void handle(actionevent arg0) { string xpath = xpath.gettext(); string website = null; if(url.gettext()!=null || !url.gettext().isempty()) if(url.gettext().startswith("http://")) website = (url.gettext()); else website = ("http://"+url.gettext()); system.out.println(website); try { if(website!=null){ document doc = jsoup.connect(website).get(); system.out.println(doc.tostring()); doc.select(xpath); } } catch (ioexception e) { e.printstacktrace(); } } });
i have tried using jsoup, doesn't seem work. jsoup not mandatory, unless succeed in highlighting element in way possible.
as of jsoup 1.8.3 (version of writing), select method expect css selector not xpath query. leaves 2 options:
option 1
turn xpath css selector.
option 2
keep xpath , use tool instead of jsoup.
Comments
Post a Comment