Question: **Environment**: Selenium testing in Java against Chrome

**Scenario**: in the GUI of my application I have a button that causes a form full of data to be submitted to an external service, whereupon the user is re-directed to the external service landing page.

Because my application is inside my corporate firewall, a username/password has to be supplied for consumption by the external service, but the application is not aware of this, so doesn't provide it (it would work normally in production, but the test environment is a special case). Therefore, a pop-up appears, and during manual testing the tester supplies a username and password manually and then submits the dialog. This is not a JavaScript dialog - I assume it's an actual modal Windows dialog, so it effectively halts processing and selenium just waits around till it's gone.

**Problem**: I am trying to automate this process, and cannot get passed the dialog. Because the dialog prevents java/selenium from processing, I cannot implement code to handle the dialog, such as integrating AutoIt or using Robot , because program flow never gets to that code after the button is pressed. Usually, I'd install an independent version of AutoIt to run on my machine in the background and catch the pop-up (not ideal, but it works), but due to very tight restrictions in the corporate domain policy this isn't possible in the short-term. I suspect they have a white-list for executables, so it may be tricky getting any third-party tool to work.

Can anybody think of a way around this?

* Can't use Alerts, as these are not JavaScript dialogs
* I have to be able to enter the username, password and submit the dialog
* Can't use integrated capabilities like AutoIt or Robot
* Can't use an independent tool like AutoIt due to domain policy

I suspect it's not possible, but worth checking if any bright spark has any ideas.

Answer: 
It's not supported in WebDriver so it can't be done using plain Selenium.

There is an issue open in the WebDriver project to support handling basic auth prompts:

<https://github.com/w3c/webdriver/issues/385>

<https://github.com/SeleniumHQ/selenium/issues/453>

Alas, the issue is open and nothing is implemented yet.
If you can't use AutoIt from another process because that process has to be in a certain whitelist, then you can probably use it from another thread using [autoitx4java](https://github.com/accessrichard/autoitx4java). If you can detect the dialog itself then you should certainly do it, but AFAIK the dialogs of Chrome are transparent to AutoIt (any other technologies based on Windows UIAutomation). In this case, just spawn the thread before pressing the button, make this thread sleep for 1 second or so (in the first statement of the thread method), and then "blindly" type the user name, Tab key, the password, and Enter. It's not very element, but I believe it should work.