2

The website I'm trying to automate has different methods of logging in, depending on the network I'm on. When I'm not on the company's network, it has its login form which is easy enough to automate. When I am the company's network, though, I have to log in via an ADFS authentication popup (this one).

I have tried passing the username and password to the URL, but this doesn't work. Is there a way to bypass this login popup?

Specs:

  • Selenium 4.0.0
  • Chromedriver 96.0.4664.35
  • Chrome 96.0.4664.110
  • openjdk 16.0.2

EDIT: In response to some of the comments, this is how I've tried passing the credentials to the URL:

driver.get(https://username:password@url)

Unfortunately I cannot share the URL due to privacy concerns.

Mattemingda
  • 61
  • 1
  • 1
  • 8
  • Can you share how you are passing the username and password to the URL. Also, what kind of popup is it? – hfontanez Dec 16 '21 at 15:02
  • 1
    Is this a public website we can see or is it internal in addition to @hfontanez question above? Presuming that the pop up is an iframe, does this answer help: https://stackoverflow.com/a/69974832/11543023 – djmonki Dec 16 '21 at 18:02
  • @djmonki you see where I was going with my question. +1. – hfontanez Dec 16 '21 at 18:33
  • [Different ways to bypass authentication popup](https://youtube.com/playlist?list=PLUtHGPC1BTj_fU1WioaskApC8p_O-A3Er). You can see [this](https://youtu.be/XlBywWsDSvk) if you want to do it via selenium 4 chromedevtools protocol – Gurmanjot Singh Dec 25 '21 at 00:17

1 Answers1

1

This popup...

BA

...looks like the Basic Authentication popup.

You can bypass the popup embedding the username and password with in the URL as follows:

driver.navigate().to("http://<username>:<password>@your.website.com/basic_auth");

A working example code which opens the URL http://the-internet.herokuapp.com/basic_auth with a valid set of credentials is as follows:

driver.navigate().to("http://admin:admin@the-internet.herokuapp.com/basic_auth");

References

You can find a couple of relevant detailed discussion in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352