Tuesday, 31 December 2013

Handling Windows Dialogs Using Selenium Part 1

The API:

The API is small and simple. It contains two Classes that will do the work for us. :)

Introducing the two imp Classes,

WindowHandler - Responsible for all the operations on Window Objects
WindowElement - Represents an Element (Object) in/or a Window

The API uses JACOB to communicate with a DLL component called ATU_WindowsHandler.dll (Developed as a part of Project) which communicates with the windows objects for performing automation .

The DLL requires Microsoft .NET  v4  to be installed in the machine. Download .NET v4 From Here
After installing the .NET Framework, follow the below steps for registering the DLL.

  • Open CMD prompt with Admin Rights
  • Change the directory in CMD prompt where the DLL file is present
  • Type the below cmd without quotes and hit Enter Key

If the DLL is in the C Drive then

for 32 Bit (x86) OS:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm C:\ATU_WindowsHandler.dll /codebase"


for 64 Bit (x64) OS:

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm C:\ATU_WindowsHandler.dll /codebase"


Notice that the path should have "Framework64"  folder for 64 bit .Net reference whereas "Framework" for 32 bit.



You should get a message as shown in the below screenshot.


As you can see, in my machine, the DLL file is located in "F" drive, after the CMD operation, the DLL is registered successfully.


Note: Sometimes, The DLL may not get registered due to security concerns 

to resolve this, try the below approach: 

  • Download the ATU WindowsHandler dll zip file. 
  • Right click on the zip file
  • Click on "Properties"
  • Click on the "Unblock" button.
  • Click on "Apply" button
  • Click on "OK" button
  • Extract the zip file
  • Register using the same command



After this, the DLL should get Registered.

Go To: Handling Windows Dialogs Using Selenium Part 2  - Contains Details regarding The usage along with Examples

13 comments:

  1. When running Selenium exception shows - Please register the ATU_WindowsHandler.dll even when registered the dll succussfully. Please help

    ReplyDelete
    Replies
    1. Are you the one who posted same question in main section? Please ask your queries at one place, that would do.

      Your env details? OS, architecture, ?

      Delete
  2. RegAsm : error RA0000 : Could not load file or assembly 'file:///C:\Users\jianfengs\Desktop\ATU\ATU_WindowsHandler\ATU_WindowsHandler.dll' or one of its dependencies. Operation is not supported.

    My evnironment: 64bit Win7, .Net V4

    ReplyDelete
  3. Hi,

    Do anyone know about how to handle a file upload in web application using selenium webdriver?

    Thanks

    ReplyDelete
  4. hi,
    if we run in remote syst, whether it will work???

    ReplyDelete
  5. I could not find the download link for these files, can you please share the link

    ReplyDelete
  6. Also, I wanted to know, how is it different from AutoIT. I am very new to automation testing and want to know more about both the tools

    ReplyDelete
  7. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium.
    Selenium

    ReplyDelete
  8. Well explained. Got to learn new things from your Blog on Appium.Appium training in chennai

    ReplyDelete
  9. It is very useful for freshers like me ..

    Thanks , ?? Automation tester

    ReplyDelete
  10. Summer training on PLC, SCADA, Automation, Instrumentation in Delhi NCR starting from every Monday and Thursday in this month. Come and Join us to learn Practical tools & techniques with job opportunities...! For Registration Contact +91-9310096831

    ReplyDelete