Handling Javascript windows with selenium is not much of a problem since selenium has an inbuilt driver to it.But the problem with websites that use windows authentication is that they are neither Javascript popups nor they can be controlled by Java AWT Robot individually.
To overcome the trickyness, we use selenium to first recognize the pop up as as Javascript pop-up and then use Java AWT Robot to enter the password.
Why use Java AWT?
Well selenium by itself cannot handle this situation.It can enter the username but cannot make a tab switch and enter the password.
Below is an image of the login ( Windows authentication ) using ASP.NET

Github link to the code :
https://github.com/Madusudanan/Selenium/blob/master/WindowsAuthHandler.java
It can also be used to handle windows of similar nature that pops up out of a browser.Usually these kinds are associated with Domain/Active directory authentication.
Code is commented for understanding.Let me know in case of any doubts or issues that you face.
Edit : As of September 26 , the above piece of code works only with Internet Explorer Driver. For other browsers we have to resort to libraries such Auto IT or Sikuli
Testing applications in Internet explorer can be tricky,for one it does not have a tool like Firebug and hence XPath finding can be difficult.But since Javascript has full power over the DOM we can write some scripts to get the element XPath by ourselves.
1)Open Internet Exploer
2)Type about:blank in the address bar and hit enter
3)From Favorites main menu select--->Add favorites
4)In the Add a favorite popup window enter name GetXPATH1.
5)Click add button in the add a favorite popup window.
6)Open the Favorites menu and right click the newly added favorite and select properties option.
7)GetXPATH1 Properties will open up. Select the web Document Tab.
8)Copy and Paste the JavaScript Snippet one code from my Git hub repository in the URL field.
9)Click Ok. Click YES on the popup alert.
10)Add another favorite by following steps 3 to 5, Name this favorite GetXPATH2 (step4)
11)Repeat steps 6 and 7 for GetXPATH2 that you just created.
12)Copy and Paste the JavaScript Snippet two code from my Git hub repository in the URL field for GetXPATH2.
13)Repeat Step 9.
Javascript Snippet one code:
https://github.com/Madusudanan/Selenium/blob/master/GetXPATH_init.js
Javascript Snippet two code :
https://github.com/Madusudanan/Selenium/blob/master/GetXPATH_final.js
You are all done!!
Now to get the XPATH of an element just select the element with your mouse. This would involve clicking the left mouse button just before the element (link, button, image, checkbox, text etc) begins and dragging it till the element ends. Once you do this first select the favorite GetXPATH1 from the favorites menu and then select the second favorite GetXPATH2. At his point you will get a confirmation, hit allow access button. Now open up a notepad file, right click and select paste option. This will give you the XPATH of the element you seek.
This has a limitation however on selecting web elements which are like menu elements within a drop down box,hidden elements etc.But comes in very handy on a general usage scenario.
By no means this is the best way to work with locators in IE.Good stable locators are often hand crafted and carefully chosen using Xpath functions and other advanced strategies.But this is good as a starting point and to build upon further
Selenium is probably the most famous open source tool for Web testing.This blog post is how to use POI in selenium web driver so that data driven testing can be performed.
Why Excel?
Excel is probably the most commonly used tool for working with test data.
You can find more about Apache POI at http://poi.apache.org/
Code is self-explanatory,documented for understanding and is hosted at Github
Code for XLS files:
https://github.com/Madusudanan/Selenium/blob/master/readExcel.java
Code for XLSX files :
https://github.com/Madusudanan/Selenium/blob/master/readExcelXLSX.java
The above code assumes that you have a structure to your excel files.The two-dimensional array gives you great control over the way you can iterate over the rows and columns of the excel file and this control comes when you have structure to your test data file,but if there is any blank cell in the middle, there is a null pointer exception that is thrown since the code assumes that the file is structured.We can add a handler here by means of a missing cell policy, but that would make the very purpose of using the two dimensional array as a backend structure meaningless.
If you dig into Apache POI a little more, you would be tempted to use its capabilities such ignoring blank cells and so on,but its a lot easier to maintain the excel file in a specified format rather than writing code to handle the brittleness of the excel file itself.The two dimensional structure forms a model through which you can build a data driven framework on top of excel using Apache POI.
If you face any issues,do let me know by commenting here or dropping me an email.