1

I need to handle authentication pop up in chrome browser with Robot Framework by pressing enter key or esc keys or click the cancel button. Like this enter image description here

I'm trying using the SeleniumLibrary Press keys,

Press Keys    None    ESC

But it doesn't work

Does someone know how to resolve this? Thank you

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
nayeonn
  • 13
  • 1
  • 4

1 Answers1

3

Regretfully there's nothing you can do through Selenium here. This window is from the so-called basic authentication, where the user is expected to enter a username and a password and is handled at http level.
The control you see - the dialog box - is an OS component, part of the browser executables itself; as such, Selenium cannot interact with it - it is sandboxed from it (on purpose, for security).

There are couple of workarounds; credentials for basic authentication can be passed through the url - if the target system does not prohibit that explicitly. That's done through a special format of the url:

http://username:password@example.com/

Another one is to use a library for desktop automation - AutoIt, or Java's Robot. But this has 2 (huge for me) drawbacks - the solution is going to be OS dependant (e.g. one for Windows, and different for Mac, Linux), and mainly - you cannot employ it in remote selenium session - you have to have that desktop automation running in the remote machine, with a desktop session it intercepts, and accessible from your execution machine.

Todor Minakov
  • 19,097
  • 3
  • 55
  • 60