Re: using Firefox accessibility for modal dialogs automation
James Teh <[email protected]> Fri, 3 Jul 2020 14:16:12 +1000
| Newsgroups | gmane.comp.mozilla.accessibility |
|---|---|
| Message-ID | <CAPHL6Cwo=C-DXwiGWBhy2Fk4TSjb6QRaG1VjAFgWUpYcGJWrEg@mail.gmail.com> |
Hi Arkady, On Wed, Jul 1, 2020 at 8:23 AM Arkady Ioffe <[email protected]> wrote: > All job done, but I stuck with modal dialogs like alert, confirm, prompt > , login .. > Do you mean modal dialogs created by Firefox or custom modal dialogs created by your application? The reason for my confusion is that you mention a login dialog. Firefox does present a login dialog, but only for HTTP authentication, which is rarely used now. Is that the one you mean? We decided to use Firefox accessibility for their automation. > OS is Windows 10 professional. Current Firefox version is 68ESR. > Cannot record user actions (button click, edit set Text, checkbox > check), as no notification happens, when modal dialog appears despite > of MouseKeyboard Hook installed and initialized for all Firefox UI > threads. > Exactly what Win32 hook is this and what notifications are you expecting? Accessibility communicates events via win events; see SetWinEventHook: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwineventhook 3. Knowing the handle to the top level UI Firefox window, we finding a > dialog by enumeration all windows belonging to the thread of top level > UI Firefox window, until Criterion2 met. > Here the Citerion2 is: window owner is the top level Firefox UI window, > window has window class "MozillaDialogClass" or "#32770". And again > comparison of our result with result of Microsoft tools showed that we > find a dialog window without errors. > Modals like alert(), prompt(), etc. don't use separate HWNDs. They use the main Firefox HWND. Looking at the code, I do see some cases where MozillaDialogClass is used, but I've actually never seen this; it may be legacy or just a wrapper window. #32770 is for system dialogs which are not managed by Firefox. Finding a Firefox dialog would be pretty tricky. Instead, I'd suggest watching for EVENT_OBJECT_FOCUS win events (one of which will be fired when the dialog appears) and looking to see if one of the ancestors has ROLE_SYSTEM_DIALOG. Alternatively, I guess you could use AccessibleObjectFromPoint, but you would need to do this on the main Firefox HWND. Hope this helps. jamie