Jump to content

how to handle windows based popup during parallel execution using auto it - (Moved)


bbc
 Share

Recommended Posts

 

In our project we got a situation to handle an windows based popup after clicking on 'SignIn' button.

We handled it using AutoIt.

But the real problem occurs while we are trying to handle popup during parallel execution on local machine.

While trying to handle the windows based popup on multiple chrome instances autoIt is not able to handle the popup.

Please suggest

 

Notes: I am currently using webdriver Io, Mocha Framework for automation 

Link to comment
Share on other sites

8 minutes ago, bbc said:

While trying to handle the windows based popup on multiple chrome instances autoIt is not able to handle the popup.

Can you show us an example of one of these popups? Also, it would help if you elaborated on "not able to handle". Show us your code and explain what isn't working as expected.

Link to comment
Share on other sites

This is the popup I need to handle once login into my application 

image.png.82746cdf04da1e0aa1f57230e29133b9.png

 

I am writing the following code to  handle the pop up , 

if (os.platform() === "win32") {
                var au = require('autoit');
                browser.pause(1000);
                au.Init();
                // au.WinActivate("MediaCloud");
                var processId=  au.WinGetProcess("MediaCloud");
               //
                //    au.WinWaitActive( processId,60);
                au.WinActivate(processId);
                au.Send("{TAB}{ENTER}");

 

It is working fine when I am launching my application in single chrome browser instance. But when I am doing parallel testing i.e launching the same application URL in different chrome  instances( Currently 3 instances), the above pop up isn't handling 

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

If you cannot find a solution with WebDriverIO functions, maybe you could use this :

#include <APISysConstants.au3>
#include <WinAPISysWin.au3>

Opt('TrayAutoPause', 0)

HotKeySet ("{ESC}", _Exit)
OnAutoItExitRegister('OnAutoItExit')

Global $hForm = GUICreate('')
Global $iMsgCreated = _WinAPI_RegisterWindowMessage('SHELLHOOK')
GUIRegisterMsg($iMsgCreated, 'WM_SHELLHOOK')
_WinAPI_RegisterShellHookWindow($hForm)

While 1
    Sleep(100)
WEnd

; possible messages : https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registershellhookwindow

Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam)
  If $wParam <> $HSHELL_WINDOWACTIVATED Then Return
  Local $sTitle = WinGetTitle($lParam)
  Local $sClass = _WinAPI_GetClassName ($lParam)
  Switch $sClass
    Case "Chrome_WidgetWin_1"
      ; do something here
    Case "Another_Class_Goes_Here"
      ; do some other things
  EndSwitch
EndFunc   ;==>WM_SHELLHOOK

Func OnAutoItExit()
    _WinAPI_DeregisterShellHookWindow($hForm)
EndFunc   ;==>OnAutoItExit

Func _Exit ()
  Exit
EndFunc

All you need to do is Run this script from the main script, and it will intercept any window created.  Simply modify the switch statement.

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