Is it possible to manually input one time password in Pa11y console?
I'm running my pa11y.js code using Node console. I'm running into issues how to manually enter the OTP that I receive on mobile.
My workflow and code snippet below:
Login page
Then comes the selection page where I select OTP. I'm able to test till this page using Pa11y
Need to input my OTP on this page
pa11y.js follows:
const pa11y = require('pa11y');
runTests();
async function runTests() {
try {
const loginOptions = {
actions: [
'set field #username to [email protected]',
'set field #password to Password1234',
'click element #submit', // Fill up login form and submit
'wait for path to be /protect-summary', // The OTP/other options selection page
'check field #radio', //selecting OTP option
'click element #submit', //Submitting second form
'wait for path to be /otp', //waiting for OTP page
'wait for path to be /account-page' //want to visit this page after OTP is entered
],
wait: 10000,
chromeLaunchConfig: {
headless: false // trying to enter the received OTP quickly on the opened browser
},
log: {
debug: console.log,
error: console.error,
info: console.log
}
}
const result = await Promise.all({
pa11y('http://localhost:3000/', loginOptions);
});
console.log(result);
} catch (error) {
console.error(error.message);
}
}
question from:
https://stackoverflow.com/questions/65849583/how-do-i-input-otp-value-in-protected-pages-using-pa11y-js 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…