Subscribe Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security. Subscribe

Login with security questions

hi ,
Im using a security question to login .
By default it contains three security question
After entering the user name it takes to next page were it contains security question
In security page it shows any two security questions to enter
From three questions random it generates two, how to enter the security questions which was randomly generated to test using robot framework

*** variables ***
{seques1} = which is your first school {seques2} = what is your nick name
{seques3} = which is your favourite pet {sequestion1} = MKR
{sequestion2} = maddy {sequestion3} = red

*** Keywords ***

{question1} = Element Should Contain {sequritylable1} {seques1} {answer1} = Enter User Input In The Field {usersecretLocator} {sequestion1}
{question2} = Element Should Contain {sequritylable1} {seques2} {answer2} = Enter User Input In The Field {usersecretLocator} {sequestion2}
{question3} = Element Should Contain {sequritylable1} {seques3} {answer3} = Enter User Input In The Field {usersecretLocator} {sequestion3}
Run Keyword If {question1} {answer1}
… ELSE IF Run Keywords {question2} {answer2}
… ELSE Run Keywords {question3} {answer3}

but in my case it was failing
showing error as it contains element which is your first school not which is your favourite pet

the security question as 6 possible ways to occur randomly while login contains only 2 questions generated.

Kindly help me with this piece of code