java - ui4j NullPointerException when calling javascript window.scrollTo -


i'm testing website using ui4j. when execute

page.executescript("window.scrollto(0,document.body.scrollheight)"); 

to scroll end of page following nullpointerexception:

exception in thread "javafx application thread" java.lang.nullpointerexception     @ com.sun.javafx.webkit.theme.scrollbarthemeimpl.getthumb(scrollbarthemeimpl.java:400)     @ com.sun.javafx.webkit.theme.scrollbarthemeimpl.thumbposition(scrollbarthemeimpl.java:284)     @ com.sun.javafx.webkit.theme.scrollbarthemeimpl.getthumbposition(scrollbarthemeimpl.java:380)     @ com.sun.webkit.webpage.twkexecutescript(native method)     @ com.sun.webkit.webpage.executescript(webpage.java:1427)     @ javafx.scene.web.webengine.executescript(webengine.java:948)     @ com.ui4j.webkit.spi.webkitjavascriptengine.executescript(webkitjavascriptengine.java:26)     @ com.ui4j.webkit.browser.webkitpage.executescript(webkitpage.java:231)     @ com.ui4j.webkit.browser.webkitpage$bytebuddy$sjiflxwz.executescript$accessor$6vhnxtog(unknown source)     @ com.ui4j.webkit.browser.webkitpage$bytebuddy$sjiflxwz$auxiliary$0udqy8ph.call(unknown source)     @ com.ui4j.webkit.proxy.webkitproxy$callableexecutor.run(webkitproxy.java:46)     @ com.sun.javafx.application.platformimpl.lambda$null$170(platformimpl.java:295)     @ com.sun.javafx.application.platformimpl$$lambda$51/1744951114.run(unknown source)     @ java.security.accesscontroller.doprivileged(native method)     @ com.sun.javafx.application.platformimpl.lambda$runlater$171(platformimpl.java:294)     @ com.sun.javafx.application.platformimpl$$lambda$50/929850074.run(unknown source)     @ com.sun.glass.ui.invokelaterdispatcher$future.run(invokelaterdispatcher.java:95)  

i tried ui4j 2.0 , 1.2.0 on mac. jdk version 1.8.0_45 .

is there configuration on ui4j missing able execute 'window.scrollto'?

i load webpage following way:

browserengine engine = browserfactory.getwebkit(); page page = engine.navigate( url ); 

am missing or there workaround 'window.scrollto' under ui4j avoid nullpointerexception?

before page.executescript() call page.show()

import static com.ui4j.api.browser.browserfactory.getwebkit;  import com.ui4j.api.browser.page;  public class sample {      public static void main(string[] args) {         page page = getwebkit().navigate("http://stackoverflow.com");         page.show();         page.executescript("window.scrollto(0,document.body.scrollheight)");     } } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -