Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]How do I Automate the SSO Login Prompt. #5053

Closed
neeldeep opened this issue Jan 19, 2021 · 4 comments
Closed

[Question]How do I Automate the SSO Login Prompt. #5053

neeldeep opened this issue Jan 19, 2021 · 4 comments

Comments

@neeldeep
Copy link

When i type the application URL I am presented with the below screen first,
image

As I enter Email Address and Click next I am have this SSO Login Window.
image

I am using Playwright with CodeceptJS and have the below code:

I.amOnPage('/');

I.usePlaywrightTo('handle ms login', async ({ browser, context, page }) => {

    const contexts = await browser.contexts(); 

    const loginPage=await contexts[0].pages()[1];

    await loginPage.waitForNavigation();

   await loginPage.fill('input[type="email"][name="loginfmt"]', 'UserEmail');
   await Promise.all([
    loginPage.click('input[type="submit"]'),
    loginPage.waitForNavigation({ waitUntil: 'networkidle0' })
]);

await loginPage.type('Username', 'Hello');

await loginPage.type('Password', '12345');

  });
@neeldeep neeldeep changed the title [Question]How do I Automate the SSO Sign Login Prompt. [Question]How do I Automate the SSO Login Prompt. Jan 19, 2021
@pavelfeldman
Copy link
Member

Looks like in your script you click 'submit' first and then you type into username and password fields. Also you have random waitForNavigations there, not sure why you need all that! https://playwright.dev/docs/next/auth has some auth examples.

@pavelfeldman
Copy link
Member

(this does not look like a bug report against Playwright, so closing!)

@neeldeep
Copy link
Author

(this does not look like a bug report against Playwright, so closing!)

HI @pavelfeldman
This was created as a question and not a bug report. I have checked the auth examples and it doesn't mention how we can handle SSO Login Prompts. The first submit is there to move from the initial page(refer first screenshot) where user has to enter the email. The Login prompt appears after the first.

@neeldeep
Copy link
Author

I have opened #5061 as I guess the information wasn't provided properly by me. The first submit is to get over the page where user has to enter Email. The next Login prompt appears after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants