I need to open the latest email in gmail and get an authentication code from the email. Using Javascript and Selenium. I need some help in opening the lates email and getting the auth code part, already did the login part. Please find sample login attached.
module.exports = async function(context, commands) {
await commands.navigate(
'https://accounts.google.com/signin'
);
try {
await commands.addText.byId('smaplemail', 'identifierId');
await commands.click.byClassNameAndWait('RveJvd snByac');
await commands.wait.byTime(10000);
await commands.addText.byXpath(
'pass',
'//input[@name="password"]'
);
await commands.click.byClassNameAndWait('CwaK9');
await commands.wait.byTime(5000);
} catch (e) {
throw e;
}
};
How should I open the latest email, and get an auth code by regex from that email?
Thanks in Advance