python - Automate website validation testing using powershell script? -
i have website in couple of forms needs filled 1 one reach final answer token no. uniquely generated each user.
manually testing on regular bases takes following steps:
1) open www.xyz.com
2) fill in first form details i.e. name, age, sex click next
3) fill in second form details i.e. address, zip, employment type click next
4) fill in third form details .... on till form 5 , click finish.
5) after clicking finish redirected final page token no.
question: how automate test using powershell script or other scripting language, when run script , completes step 1 one , give me token no. output if test passes ?
to give set off, load document in chrome or explorer developers tools activated (press f12) , inspect objects want find. able see dom of document loaded website.
here sample login:
$ie = new-object -comobject 'internetexplorer.application' $ie.visible= $true $username="username@domain.com" $password="password" $ie.navigate("https://www.yourwebsite.com") while ($ie.busy -eq $true) { start-sleep -seconds 3 } $usernamefield = $ie.document.getelementbyid('email_id').value="$username" $passwordfield = $ie.document.getelementbyid('password').value="$password" $link = $ie.document.getelementbyid('login_id') $link.click() #or $link.submit() $ie.quit()
once logged in, can start picking objects , proceed in same way.
note: pick proper objectids , put in getelementbyid accordingly.
hope helps.
Comments
Post a Comment