Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ozhan Duz
    @ui4j
    Hi @publicspace, first of all sorry for the late response. ui4j is used directly javafx's webkit browser, and this means that its fully functionall web browser. You could crawl javascript pages with ui4j. Just check the bing example from here: https://github.com/ui4j/ui4j/blob/master/ui4j-sample/src/main/java/com/ui4j/sample/BingSearch.java
    Holger Staudacher
    @hstaudacher
    Seems like the 2.0 release gets better and better ;)
    David Rehmat
    @daretodave
    Hey.
    Are you guys planning to update the maven repo with 2.0
    Ozhan Duz
    @ui4j
    You could check the open issues from here https://github.com/ui4j/ui4j/milestones/2.0.0 it will be released when the all issues resolved.
    Holger Staudacher
    @hstaudacher
    Thanks @ui4j for being so responsive and for fixing issues in no time ;)
    SecretService
    @publicspace

    I am using java 8u40 and getting the following error but only for cetain pages:

    Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
    at com.sun.javafx.Utils.getScreen(Utils.java:686)
    at com.sun.javafx.webkit.WebPageClientImpl.getScreenBounds(WebPageClientImpl.java:105)
    at com.sun.webkit.WCWidget.fwkGetScreenRect(WCWidget.java:118)
    at com.sun.webkit.Timer.twkFireTimerEvent(Native Method)
    at com.sun.webkit.Timer.fireTimerEvent(Timer.java:83)
    at com.sun.webkit.Timer.notifyTick(Timer.java:64)
    at javafx.scene.web.WebEngine$PulseTimer.lambda$static$45(WebEngine.java:1167)
    at javafx.scene.web.WebEngine$PulseTimer

    KaTeX parse error: Unexpected character: '$' at position 6: Lambda╠▓$80/472712320.: Lambda$80/472712320.pulse(Unknown Source)
        at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:314)
        at com.sun.javafx.tk.Toolkit
    Lambda$112/448131263.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:313)
    at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:340)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:525)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:505)
    at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$400(QuantumToolkit.java:334)
    at com.sun.javafx.tk.quantum.QuantumToolkit
    KaTeX parse error: Unexpected character: '$' at position 6: Lambda╠▓$50/1051608198: Lambda$50/1051608198.run(Unknown Source)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at com.sun.glass.ui.gtk.GtkApplication.lambda$null$48(GtkApplication.java:139)
        at com.sun.glass.ui.gtk.GtkApplication
    Lambda$46/1572221016.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)

    Also, the monocle maven plugin for headless mode is causing:

    #

    A fatal error has been detected by the Java Runtime Environment:

    #

    SIGSEGV (0xb) at pc=0x00007f249b5920f8, pid=21784, tid=139795532248832

    #

    JRE version: Java(TM) SE Runtime Environment (8.0_40-b26) (build 1.8.0_40-b26)

    Java VM: Java HotSpot(TM) 64-Bit Server VM (25.40-b25 mixed mode linux-amd64 compressed oops)

    Problematic frame:

    C [i965_dri.so+0x31b0f8]

    #

    Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

    #

    If you would like to submit a bug report, please visit:

    http://bugreport.java.com/bugreport/crash.jsp

    The crash happened outside the Java Virtual Machine in native code.

    See problematic frame for where to report the bug.

    I also have another question with regards getting innerhtml for the entire page, including html, head, body and so on. I am only able to call page.getDocument().getBody().getInnerHTML() ... there is no page.getDocument().getInnerHTML() ... shouldn't there be ?
    Ozhan Duz
    @ui4j
    Hi @publicspace, this is an JavaFx bug https://javafx-jira.kenai.com/browse/RT-46189
    its resolved by Oracle and will be ready for Java 8u60, its not released yet.
    For ui4j we found a workaround solution and it will ready for version ui4j 2.0
    ui4j/ui4j#24
    version 2.0 will be released at July 1
    rc183
    @rc183
    Hi. I try to use ui4j but when I launch my jar on ubuntu server 14.10, my browser object is null with the code : BrowserEngine browser = BrowserFactory.getBrowser(BrowserType.WebKit);
    You know why ?
    Ozhan Duz
    @ui4j
    Ui4j requires ui4j-all or ui4j-webkit jar. Most probably your classpath contains only ui4j-api.jar.
    Mike Markus
    @Waterstraal
    This might be a dumb question, but I can't find it anywhere, so I'll ask it here: Is it possible to open a page in certain dimension (width, height)? It appears that fullscreen is 1280x800
    Ozhan Duz
    @ui4j
    Hi @Waterstraal Yes, you could set the width and height of the window
    WebView view = (WebView) page.getView();
    view.getScene().getWindow().setWidth(200);
    view.getScene().getWindow().setHeight(200);
    Mike Markus
    @Waterstraal
    Works like a charm, thank you!
    Ozhan Duz
    @ui4j
    This message was deleted
    lagoonos
    @lagoonos
    Hi, I try to run ui4j within a JavaFX application to load webpage data in the background. I get a NullPointerException in com.ui4j.webkit.WebKitBrowser.run() in line 313 latch.countDown(); Any idea? Do I need to configure something when ui4j is running within a JavaFX application?
    Ozhan Duz
    @ui4j
    This message was deleted
    Hi @lagoonos Could you please share your sample code
    Ozhan Duz
    @ui4j
    skaros
    @skaros
    hi i posted this question on SO as well. I am trying to create a java application to automate a procedure on this site. I want to click on an item, with Id T:df6yt:0:jfcx6 but ui4j can not find it and i am getting an error. Thanks in advance
    Ryan Peterson
    @rpeterson03
    @ui4j Awesome project. I think I will be able to use your library in place of at leas two other libraries maybe three. I was hoping you(or someone with more experience) could help me with something. I am trying to load a page and then find images at potential x,y coordinates. I tried doing this by executing JS, but it kept coming back null. Then I found the "getElementFromPoint" in your API. I have tried to implement it with no luck. I was hoping you might have an example or could at least confirm that I am on the right path.
    Ozhan Duz
    @ui4j
    Hi @rpeterson03 I just commit sample test for getting image offset
    ui4j/ui4j@fdad275
    You could search all images by their offset
    let me know if this solution is not suitable for your case
    Ozhan Duz
    @ui4j
    You must call page.show() before using getElementFromPoint()
    Ryan Peterson
    @rpeterson03
    @ui4j that may actually work better than what I was doing. I was also not calling page.showI() so that's a good tip.
    Thankyou!
    Ryan Peterson
    @rpeterson03
    @ui4j I hit a snag. For my use case I am trying to get at logos on a web page and one of the problems is that logos are often set as css background images against an href. Wordpress.org is a good example. So the problem is that when I use .getDocument it is only returning the html which does not have reference to the css images. Ultimately I was hoping that by having the webkit render form I could get access to images in the final form by referencing the position. My logic being that i would be like right clicking and inspecting the element. Unfortunately I don't see clearly how I could reference an image like that. I could reference the href, but it's not clear how I would get at its calculated css to get the background-image attribute.
    Ozhan Duz
    @ui4j
    @rpeterson03 You could use Element.getCss(String) to find all links that have background-image css style

    Sample code: ```package com.ui4j.sample;

    import java.util.List;
    import java.util.stream.Collectors;

    import com.ui4j.api.browser.BrowserEngine;
    import com.ui4j.api.browser.BrowserFactory;
    import com.ui4j.api.browser.Page;
    import com.ui4j.api.dom.Document;
    import com.ui4j.api.dom.Element;

    public class Sample {

    public static void main(String[] args) {
        BrowserEngine webkit = BrowserFactory.getWebKit();
        Page page = webkit.navigate("http://ran.ge/2009/11/11/css-trick-turning-a-background-image-into-a-clickable-link/");
    
        Document document = page.getDocument();
        List<Element> links = document.queryAll("a");
    
        List<Element> linksWithBackgroundImage = links
                                                    .stream()
                                                    .filter(e -> e.getCss("background-image").isPresent())
                                                    .collect(Collectors.toList());
    
        linksWithBackgroundImage.forEach(e -> { System.out.println(e.getCss("background-image").get()); });
    }

    }```

    aleksey
    @lehins83
    This message was deleted
    aleksey
    @lehins83

    Hi, first of all thanks for great lib you provide. It really helps. But I have a question. I use ui4j for scrapping web pages with javascript generated content. So I need some browser. And I have url queue and processing it using ui4j. And looks like there is a memory leak. There are 3,102 instances of "com.sun.javafx.webkit.prism.WCImageDecoderImpl", and it occupies 1.5 GB of memory.

    Is this me who doing something wrong?

    Ozhan Duz
    @ui4j
    Hi @lehins83, that memory leak related with JavaFx
    I am going to publish workaround solution to solve that memory leak
    You need to checkout latest master branch (2.1.0-SNAPSHOT) to use the sample
    Let me know you if this sample enough to fix your memory leak problem
    aleksey
    @lehins83
    Hey, @ui4j thanks a lot it works. No leaking now!

    I have one more question.
    If I don't use browse.show() I just use

    String html = (String) page.executeScript("document.documentElement.innerHTML");

    to get page's html, do I really need to use "headless" mode?

    uPeekit
    @uPeekit
    Hey. Is there any way to use proxy in ui4j?
    Ozhan Duz
    @ui4j
    Hi @lehins83 headless mode is optional feature for continous build etc. you could optionally use page.show() or headless mode