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

14 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. I am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts. Python Projects for Students Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account. Project Center in Chennai

      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. Using AutoIt will work for file upload.

    Test Automation

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

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

    ReplyDelete
  7. 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
  8. 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
  9. Well explained. Got to learn new things from your Blog on Appium.Appium training in chennai

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

    Thanks , ?? Automation tester

    ReplyDelete
  11. 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