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()