0

I'm trying to scrape a HTML page with jsoup. However, in order to get the data I need I need to click an HTML button (<button> not <input>). Is there any way to do so in Java/Kotlin?

Here is the what the button HTML looks like:

<button type="button" class="btn table-toggle" data-column="0,1,2,3,4" data-sort="1" data-sort-dir="desc">Base Stats</button>

This is not the same as Can Jsoup simulate a button press? that question was talking about an <input> form, this is different.

Galak Fyyar
  • 56
  • 2
  • 7

1 Answers1

-1

Try this in HTML:

<!DOCTYPE html>
<html>
<body>

<p>Hover over the checkbox to simulate a mouse-click.</p>
  <button id="myCheck" onmouseover="myFunction()" onclick="alert('click event occured')">Foo</button>

<script>
function myFunction() {
    document.getElementById("myCheck").click();
}
</script>


</body>
</html>