Javascript to Automate PIN login code

Hi,
I’m a bit of a novice at this so please bear with me :).
I have written scripts in KR that auto populate application forms for use by trainees as practice scenarios in assessment. However, one stumbling block I’ve hit is the Login process before the application form can be started. A user account has to be created with a Username, Password and 6 digit PIN. At Login, three random digits from this PIN are requested. I haven’t been able to figure out how to write an extension script that can use If commands to automatically select the required PIN digits.

The fields on the login screen are named pinbox1, pinbox2 and pinbox3 with the label on each pinboxlabel1…2…3, with the label values being 1st, 2nd, 3rd, 4th, 5th, 6th. PIN code used is usually generic like 010101 as there are security validation around using the same number, or sequential numbers.

Can anyone help me with the javascript and how to add this to my KR scripts please?

Hi there,

Could you provide us with a sample of your test script so we could try testing it and see what’s going on?

Have you given up on this :question:

I’d take the lack of response in that time to be either given up, solved it themselves, or moved on to something else.

1 Like

Hi Guys, I’m really sorry, I never saw the responses to my thread. Unfortunately I never got this to work, so had to do a lot of manual work instead. My javascript script looks something like this(sample of Pin1 field). Does the Javascript make sense and how can it be incorporated into the KR script? Thanks

function Pin1() {
if(Pin1Label == ‘1st’){
Pin1 = 2;
}
else if(Pin1Label == ‘2nd’){
Pin1 = 0;
}
else if(Pin1Label == ‘3rd’){
Pin1 = 2;
}
else if(Pin1Label == ‘4th’){
Pin1 = 2;
}
else if(Pin1Label == ‘5th’){
Pin1 = 2;
}
else{
Pin1 = 4;
}
}