How to skip Azure authentication everytime logging into the site: Selenium WebDriver

2,029 views
Skip to first unread message

Praveen P

unread,
Oct 1, 2015, 7:55:46 PM10/1/15
to Selenium Users
Hi All,

I am automating a few test scenarios on a website. Opening of website requires Azure authentication.

If I open the same website in regular browser (Chrome/IE) Azure AD page comes up for entering user name passwords. Subsequent openings of the website, will skip this authentication page (as the browser would have stored a cookie).

But if selenium tests are run everytime a new instance of browser is opened, need to login to Azure for logging into the site.

Is there a way to provide credentials to the browser instance to skip this password entry in test automation?


Thanks,
Praveen

David Corbin

unread,
Sep 7, 2020, 11:57:00 AM9/7/20
to Selenium Users
5 years on, and still no response????

ddlionx

unread,
Sep 7, 2020, 4:07:28 PM9/7/20
to seleniu...@googlegroups.com
...leaving your comment aside, I have seen people work around problems like this: https://www.selenium.dev/documentation/en/support_packages/working_with_cookies/

That being said, personally I would add some kind of testability improvement (e.g. a backdoor) to circumvent such authentication in the apps "test mode". You're not testing Azure's AD login.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/aa79d411-bfa9-4cd1-affc-fd4afe249c53n%40googlegroups.com.

David Corbin

unread,
Sep 7, 2020, 4:12:06 PM9/7/20
to Selenium Users
"That Guy" ... Thanks for the response, however that is not really applicable (at least to me).... It is easy to replicate the requirement, simply set up a dummy dev.azure.com account if you don't have one..... Now write a simple (I prefer c#, but any language) Selenium test that knowing the username and password can be used on any system (i.e. there is not a pre-existing cookie, or the cookie may have expired, or may have been deleted) so that you can get past the authentication screens and to the home page....

ddlionx

unread,
Sep 7, 2020, 4:37:18 PM9/7/20
to seleniu...@googlegroups.com
It applies but is complex. You would need to recreate the processes Azure AD uses to authenticate you and add those to the browser, e.g. the access token and the token expiry. You can see an example of something like this being done in Cypress here: https://mechanicalrock.github.io/2020/05/05/azure-ad-authentication-cypress.html.

Again, I think your best course of requirement is to find some testability improvement that removes the reliance on Azure AD when the application (or whatever it is you're testing) is running in "test mode". You don't work for Microsoft so including that part every time is unnecessary.

David Corbin

unread,
Sep 7, 2020, 4:41:09 PM9/7/20
to Selenium Users
While I would agree in other circumstances, the use case here is to actually "test" Azure DevOps  (e.g. looking for changes in UI as they roll out new versions every three weeks)...

So what I want to do is find the "text area" (using the term loosely) to simulate typing the username (e-mail) and password... It is possible that the screens are using JAvascript to capture the key events, in wich case I would want to simulate that....

I am *not*  looking to do anything fundamentally different than what happens in a pure manual set of actions as that would defeat the primary purpose (i.e. I want my test to fail if the authentication UI sequence changes in some way)

ddlionx

unread,
Sep 7, 2020, 4:53:20 PM9/7/20
to seleniu...@googlegroups.com
In which case I am not following because your original post sounded like you wanted to bypass the login screen? Do you mean you only want to bypass them sometimes or once? In which case, I suppose you could abstract out the method of authenticating and only use it for the tests you don't want authentication on? Or have different versions of the app for testing different things? Honestly, that's more or an organisational issue. Have I provided any insight on your Selenium question at least?

David Corbin

unread,
Sep 8, 2020, 7:26:35 AM9/8/20
to Selenium Users
Fir I need to apologize. OVer the weekend I was using my phone. I had made two postings. The first was a "new conversation" and the other was a "comment" (this thread is the comment).

I got confused and thought the reply was to my "new conversation" based only on seeing " .leaving your comment aside " - which I took to mean "leaving the posting of a comment on a different thread aside". I mentally reinforced this mistake when I read ""...because your original post sounded...."  where the only "original post" I have made (at leastr in a very long time) was the other thread...

I agree that prave...@gmail.com's post from Oct 1, 2015, 7:55:46 PM appears to have been about using cookies directly, so I apologize again.....

But hopefully can get an answer to my problem under my actual thread....    https://groups.google.com/g/selenium-users/c/lDRxcDgdPSg 

Again my apologies for causing confusion. 


Reply all
Reply to author
Forward
0 new messages