Skip to content

Instantly share code, notes, and snippets.

@samhstn
Created June 20, 2023 11:40
Show Gist options
  • Save samhstn/1db4e3016200580c1118f53b7c2d6ad4 to your computer and use it in GitHub Desktop.
Save samhstn/1db4e3016200580c1118f53b7c2d6ad4 to your computer and use it in GitHub Desktop.
const sleep = async () => new Promise((resolve) => setTimeout(resolve, 1000))
async function run() {
document.querySelector('select[name="productType"]').selectedIndex = 1
document.querySelector('.button_atom').click()
await sleep()
document.querySelector('select[name="title"]').selectedIndex = 1
document.querySelector('input[name="fname"]').value = 'Sam'
document.querySelector('input[name="lname"]').value = 'Houston'
document.querySelector('input[name="dateOfBirthDay"]').value = '20'
document.querySelector('input[name="dateOfBirthMonth"]').value = '11'
document.querySelector('input[name="dateOfBirthYear"]').value = '1993'
document.querySelectorAll('.button_atom')[1].click()
await sleep()
document.querySelector('select[name="residentialStatus"]').selectedIndex = 2
document.querySelector('input[name="postcode"]').value = 'TW11 8SG'
Array.from(document.querySelectorAll('button')).find(b => b.innerText === 'Find address').click()
document.querySelector('select[name="yearslist"]').value = Array.from(document.querySelectorAll('select[name="yearslist"] > option')).find(o => o.innerText.includes('16')).value
// change this manually
}
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment