IMPORTANT NOTICE: As of 21 February, anything posted in this community WILL NOT BE MIGRATED to our new community site. We have pulled all user information and data from this site and are now in an approximately week long process of importing users, roles, and data to our new site. We are leaving this site open and active so you can post and hopefully get a response until the migration is complete. Once complete, the URL that currently takes you to this site will take you to our new site so your bookmarks will work as always. Please read the information on a New Login Process
Missing basic authentication test support is a general issue and depends on how the browser vendors are supporting it. As an example there is an open Chrome bug report here that states that the webdriver is at fault:https://bugs.chromium.org/p/chromedriver/issues/detail?id=1917 However, for both Chrome and Firefox, Silk Test can be used to overcome the authentication URL problem when a test starts.
Workaround for Chrome: --------------------------- The following .NET script is using 'http://the-internet.herokuapp.com/basic_auth' as the authentication example. Ensure that the starting page of the script is 'about:blank' or another non-basic-authentication URL. Imports SilkTest.Ntf.XBrowser Imports SilkTest.Ntf.Win32 Imports System.Threading Imports System.Console Public Module Main Dim _desktop As Desktop = Agent.Desktop Public Sub Main() ' calculate encrypted password token that can be used in password fields instead of plain password Console.WriteLine("Password token: " + Agent.Encrypt("admin")) ' enter URL and navigate using accessibility With _desktop.AccessibleControl("//BrowserApplication//AccessibleControl[@caption='Address and search bar']") .Click() .TypeKeys("<Ctrl+A>") .TypeKeys("http://the-internet.herokuapp.com/basic_auth") .TypeKeys("<Enter>") End With ' wait a moment until document is loaded Thread.Sleep(2000) ' enter credentials using Win32 type keys With _desktop .TypeKeys("admin<Tab>") .TypePasswordKeys("5ERzHMbN") ' password token for "admin" .TypeKeys("<Enter>") End With ' verify basic authentication succeeded With _desktop.BrowserWindow() Workbench.Verify("Basic Auth", .DomElement("//H3").Text) End With End Sub End Module Workaround for Firefox: ------------------------- A similar script works for Firefox using the Alert API. This has been tested against Firefox 58: Imports SilkTest.Ntf.XBrowser Public Module Main Dim _desktop As Desktop = Agent.Desktop Public Sub Main() _desktop.BrowserApplication.Navigate("http://the-internet.herokuapp.com/basic_auth") ' enter credentials using Alert API backed by Selenium Dim seleniumTabKey = Convert.ToChar(&HE004) Dim myUserName As String = "admin" Dim myPassword As String = "admin" _desktop.BrowserWindow().AcceptAlert(myUserName & seleniumTabKey & myPassword) ' verify basic authentication succeeded With _desktop.BrowserWindow() Workbench.Verify("Basic Auth", .DomElement("//H3").Text) End With End Sub End Module There is an alternative and that is to install browser extensions that support auto-login. However, this may fall foul of company security requirements.Chrome: https://chrome.google.com/webstore/detail/multipass-for-http-basic/enhldmjbphoeibbpdhmjkchohnidgnah?hl=en Firefox: https://addons.mozilla.org/en-US/firefox/addon/autoauth/