0

I attempt to automatically click on the button "Load more" in the following link javafx webview https://www.youtube.com/channel/UCK-ds1Wsdd2wn1JElOIUSWQ/videos

Source code in Youtube : "Load more" as below

<button class="yt-uix-button yt-uix-button-size-default yt-uix-button-default load-more-button yt-uix-load-more browse-items-load-more-button" type="button" onclick=";return false;" aria-label="Load more
" data-uix-load-more-target-id="browse-items-primary" data-uix-load-more-href="/browse_ajax?action_continuation=1&amp;continuation=4qmFsgI8EhhVQ0stZHMxV3NkZDJ3bjFKRWxPSVVTV1EaIEVnWjJhV1JsYjNNZ0FEQUNPQUZnQVdvQWVnRXp1QUVB"><span class="yt-uix-button-content">  <span class="load-more-loading hid">
      <span class="yt-spinner">
      <span class="yt-spinner-img  yt-sprite" title="Loading icon"></span>

Loading...
  </span>

  </span>
  <span class="load-more-text">
    Load more

  </span>
</span></button>

JqueryEmbed.executejQuery use of jewelsea https://gist.github.com/jewelsea/3077942

 @Override
    public void initialize(URL url, ResourceBundle rb) {
        // TODO
        WebEngine engine = browser.getEngine();
        engine.documentProperty().addListener((ObservableValue<? extends Document> observable, Document oldValue, Document newValue) -> {
            JqueryEmbed.executejQuery(engine, "$(document).ready(function(){"
                        + "$('button.browse-items-load-more-button').click();"
                    + "});");
        });
        engine.load("https://www.youtube.com/channel/UCK-ds1Wsdd2wn1JElOIUSWQ/videos");
    }

If I use the jquery hidden button "load more" to test it works.

+ "$('.browse-items-load-more-button').hide();"

But when the user clicks it does not work,

+ "$('button.browse-items-load-more-button').click();"

and the button that contains the following code

onclick = "; return false;"

We tried but I failed, program error, I do not know how to fix it

Please help me

Ma Tâm
  • 307
  • 4
  • 20
  • What kind of error? Have you tried to debug the webview with [FireBug](http://stackoverflow.com/questions/17387981/javafx-webview-webengine-firebuglite-or-some-other-debugger)? – hotzst Jan 14 '17 at 08:21
  • I do not find it an error, I've edited my question to understand. Please see help me fix it – Ma Tâm Jan 14 '17 at 11:12
  • 1
    It is still not clear what you are asking. What outcome do you expect when the user clicks the button? What does actually happen? And where do you place the `+ "$('.browse-items-load-more-button').hide();"` in your code that allegedly makes it work? – hotzst Jan 14 '17 at 11:46
  • I use it to test the program. – Ma Tâm Jan 14 '17 at 13:34

0 Answers0