How do I use Selenium to login to sites that require HTTP basic authentication (where the browser makes a modal dialog asking for credentials)?
Use a username and password in the URL,as described in RFC 1738:
Test Type
open 07001
Note that on Internet Explorer this won’t work,since Microsoft has disabled usernames/passwords in URLs in IE. However,you can add that functionality back in by modifying your registry,as described in the linked KB article. Set an “iexplore.exe” DWORD to 0 in HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMainFeatureControlFEATURE_HTTP_USERNAME_PASSWORD_DISABLE.
If you don’t want to modify the registry yourself,you can always just use Selenium Remote Control,which automatically sets that that registry key for you as of version 0.9.2.