Having trouble working with running JS on consecutive webviews

So I am trying to help someone automate the process of checking their student in for daily health screenings with the NY Department of Education.
The website can be found here:
https://healthscreening.schools.nyc/?type=G

So I am a little shaky with my web development skills, so I am not sure what to call the two “pages” that need to be filled out. On “Page 1” there is a submit button (which to get side tracked for just a second, I can not click with Javascript), when that button is clicked, the page does not refresh, it just presents different content. I am guessing this is some form of Javascript wizardry.

My problem is that, since I can’t click the submit button on either of the “pages”, I need the user to be able to click the submit button from a presented webview, that then will turn into the “second” page where more information needs to be filled out (so more javascript needs to be run). I can only seem to get the JS run on “page 1”. If I put additional JS after the present line, only a blank screen will appear with no actual web page.

What the heck I am doing wrong here?

Here is my code.

function sleep(milliseconds) {
  const date = Date.now();
  let currentDate = null;
  do {
    currentDate = Date.now();
  } while (currentDate - date < milliseconds);
}

let url ="https://healthscreening.schools.nyc/?type=G"
let wv = new WebView()
await wv.loadURL(url)
let js = `
document
  .getElementById('guest_isStudent').checked = true
  document
  .getElementById('guest_first_name').value="Dan"
  document
  .getElementById('guest_last_name').value="Does"
  document
  .getElementById('guest_email').value="dan@dandoes.com"
  document
  .getElementById('other_checked').click();
  document
  .getElementById('guest_location').value="PS 99"
  document
  .getElementById('guest_location_floor').value="1"
document
.getElementById("btnDailyScreeningSubmit").querySelector('button').click();
`
let link = await 
wv.evaluateJavaScript(js)
sleep(2000)
let js2 = `
   document
 .getElementById('q1no').click();
document
.getElementById('q2no').click();
document
.getElementById('q3no').click();
document
.getElementById('q4no').click();
  
  `

 let link2 = await wv.evaluateJavaScript(js2) 
wv.present()

Hello there.

I’ve checked out that webpage, and although there are cookies involved, they don’t seem necessary. This simplified curl command seems to work just fine as a single-step submission:

curl "https://healthscreening.schools.nyc/home/submit" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" --data-raw "Type=G&IsOther=False&IsStudent=0&FirstName=Test&LastName=User&Email=delete%40me.com&State=NY&Location=10X815&Floor=99&Answer1=0&Answer2=0&Answer3=0&ConsentType="

but the answer is in JSON format. You’ll have to apply the HTML+CSS formatting to it.