0

I am working on an application that whenever I call a page from the menu, the URL does not change. I'm new to Selenium and am creating automation test scripts to perform test cases.

But, for each test script, I have to add a script for user authentication to call the login page and call the required page from the menu.

Is there a way I can call the page directly without user authentication?

1 Answer 1

1

The quick answer is: no. Unless you have user authentication turned off in a dev or test (non-production) environment, you can't bypass it! This would be a security issue and could cause more bugs to occur, as you'll get used to testing software without authentication. This will create a "blinder" for you, which you don't want!

So what can you do?

  1. Have your test automation always login. Create a login class/method that you can use for any test.

  2. Using code, generate a user authentication token. You can pass this token in your beforeAll() method and have your automation library (Selenium, Cypress, Playwright, etc) use DevTools to set a cookie or session/user token.

The second option is highly dependent on what software is being tested. It can be based on language, library/framework, or even APIs being used. I recommend working with your dev team to understand what's being used. Hopefully, it's an API, which will make it a lot easier!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.