1

enter image description hereI am a QA analyst with some JS knowledge and am using Selenium Webdriverjs for some automation. The site requires username/password, so it was designed using the embedded credentials to login (https://user:password@address.com). However, with the recent update to Chrome 59 this week, this ability is no longer allowed, even as a configuration change. Does anyone know how to handle the authentication box that appears when you reach a site that requires it? I have tried treating it as an alert box and do not believe it is a modal window. Any help would be greatly appreciated.

  • Go With [AutoIt](https://stackoverflow.com/questions/20568387/login-to-chrome-authentication-window-using-autoit) – Madhan Jun 08 '17 at 18:56
  • Are you using Active Directory? Chrome and IE share an Internet Setting that can auto respond to those requests if so. – Timothy Cope Jun 08 '17 at 21:19
  • Thanks for the info. No, not using AD, I am running Mac OS. Selenium starts up a separate/new instance of the browser, so none of the existing browser settings are available. This helps in testing to prevent cached info influencing test results. But it means any browser settings need to be passed in through the script. This credential box is really stumping me. – user2554353 Jun 09 '17 at 01:41
  • Can you clarify the problem you're having with a screenshot perhpas? But you should be able to load a custom profile with the saved passwords using chrome options and loading your user profile. Another way would be to include Robot.js and have robotjs interact with the dialogue. – codemon Jun 17 '17 at 17:41
  • Thank you Rup for the info, i will look at Robot.js and also using a custom profile. The profile method may not be a good approach though, as I wan't to try and avoid any environmental corruption in testing. I think interacting with the message box is a better approach. I will update the question with a screenshot of what I am trying to interact with. Right now, as a temporary (yet hackey) fix, I have included a second `get` which works. Any help is always appreciated. – user2554353 Jun 26 '17 at 18:40

1 Answers1

0

There is a nice hack mentioned by a SO user zoonabar in this SO post. If you hit a resource/URL with valid credentials , before actually hitting the URL that needs credentials, then browser caches the authentication and then you can use it. Please see his answer.

This has also been discussed here - SO Post about Basic Authentication.

Another option is to run a transparent proxy to inject the header with the required credentials- mentioned by Florent B in the same link mentioned above.

In our case, Option 1 (by zoonabar) worked out. You can also try his hack.

demouser123
  • 4,108
  • 9
  • 50
  • 82
  • Thank you demouser123, this is what I am using right now, with a second `get` to the same address. Even though it works, it is kind of a hack for now. Eventually it may not work either, so I want to figure out how to interact with the message box. – user2554353 Jun 27 '17 at 21:27
  • You can upvote and accept the answer if you like it :) – demouser123 Jun 28 '17 at 04:48