I'm trying to scrape data from an html file. Specifically, I need the value of a variable in an input. Below I have an example of an input and what I have tried to do so far (I am specifically trying to get the "data-inital-value:
Input:
<input type="username" class="whsOnd zHQkBf" jsname="YPqjbf" autocomplete="current-username" spellcheck="false" tabindex="0" aria-label="Enter your username" name="usernamefield" autocapitalize="off" dir="ltr" data-initial-dir="ltr" data-initial-value="trying to get this" badinput="false">
My code:
<script>
String uname = document.getElementById('usernamefield').value
</script>
id="usernamefield"attribute in your HTML, what isgetElementById()supposed to find?