Jump to content

When is the right time to launch the script? [newbie question]


abarlev
 Share

Recommended Posts

I am using Selenium to test secure websites requiring smart card authentication.

The security window that pops up requesting the smart card PIN code is a windows object, therefor cannot be handled by Selenium.

I wrote the following AutoIT script which responds to the popup:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Grafikartes-Adobe-Cc-Folders-ID.ico
#AutoIt3Wrapper_Outfile=SetPinCode_x86.exe
#AutoIt3Wrapper_Outfile_x64=SetPinCode_x64.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
WinWaitActive("Windows Security", "OK")
ControlClick("Windows Security", "OK", "[CLASSNN:Button2]")
WinWaitActive("IDProtect Verification")
Send("TestCard")
WinWaitActive("IDProtect Verification", "Verify")
ControlClick("IDProtect Verification", "Verify", "[CLASSNN:Button2]")

The script works fine when launched manually. Although, I noticed that I need to set focus on the popup in order for it to work.

When I launch from within the application, it does not respond.

I tried execution of the exe before and after launching the tested website, neither with much success.

Any suggestions would be extremely appreciated.

Thanks,

Asaf

Link to comment
Share on other sites

Might just be administrative permissions. Run Selenium with admin rights and include #RequireAdmin on the top of your script (just to make sure).

For the activation of the window, instead of:

WinWaitActive("Windows Security", "OK")
 
Write:
 
WinWait("Windows Security", "OK")
WinActivate("Windows Security", "OK")

So that WinWait waits until the window exists, and you then activate it yourself with WinActivate.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...