You don't need to use AutoITX for what you want to do.
The AutoITX library you use, we use it only when we want to "select" a file to upload (when the a popup appears that will show the files in your system).
What you see here is an "Alert" and there are a lot of implementations in selenium itself that lets you handle the alert.
Think of an alert as a seperate "browser tab" that you want go to it (switch to it), and handle elements on it. There are a lot of different types of alerts. Some will simply appear and have an OK button, some will have a Yes or No, and others (like yours), will be an authentication form.
You can tell your selenium webdriver to switch to alert (when it is shown), then enter the credentials and click OK. All through the webdriver, with no AutoITX needed.
A simple implementation will be:
//Switch to the alert
IAlert alertHandler = driver().SwitchTo().Alert();
//Send the credentials
alertHandler.SetAuthenticationCredentials("Username", "Password");
//Switch back to the default content (your main tab).
driver().SwitchTo().DefaultContent();
There are also implementations for other kinds of alerts
//Accepts the "OK" alert or clicks "Yes" on the yes/no alert.
alertHandler.Accept();
//Clicks Close/Dismiss/No
alertHandler.Dismiss();
And to answer your original question as to HOW to WAIT for an alert, here is my implementation
public static bool IsAlertPresent()
{
int secondsToWait = 1; //Wait for 1 second.
try
{
new WebDriverWait(driver, TimeSpan.FromSeconds(secondsToWait)).Until(ExpectedConditions.AlertIsPresent());
return true;
}
catch (WebDriverTimeoutException) { return false; }
}