user2753523 user2753523 - 15 days ago 7
Java Question

How to get control to selenium web driver browser window

I am developing the automation scripts for a web site using java selenium web driver.

But that web site is requesting for "Authentication required" (window) for two times.

I handled the first "Authentication required" window using modifying the URL like below

http://username:password@thaturl.com


But to handle second "Windows authentication", I dependent on multi processing.

I have done the following for handling second "Authentication required" window

Whenever the browser got stucks at "Authentication required" window, then I will be
starting a small http server and opening a url, that opened url will type the username
and password in the "Authentication required" window ( i.e. I am triggering another
process through a url by creating handler for that url which will copy username and
password in the "Authentication Required" window)


But my problem is that the web driver window is not getting on top of all other windows, so I am not able to copy username and password at exact place using robot object.

Thanks in advance

Answer

You can use AutoIT to automate window dialogs and for your scenario, you can actually bring a particular window into focus as well.

Here is one reference, but there are lot of posts available on this topic.