Help to obtain information in a plug-in module for Chrome browser


Héctor Javier Benítez Corredera
 

Hi, I have a small add-on with some improvements that I need in the Chrome browser.

But I have a small problem that I can not know how to do.

When we download something with Chrome creates a Role.ALERT in which we are informing us of the download status by message and when it ends creates another with the message that the download is finished we press F6 to go to the download bar.

Well I paste my Developer info for navigator object: it can that when translating the message something remains in Spanish that is my language:

Developer info for navigator object:
name: 'Download complete: winrar-x64-611en.exe. Press Shift+F6 to move to the download bar area'.
role: Role.ALERT
roleText: None
states:
isFocusable: False
hasFocus: False
Python object: <NVDAObjects.Dynamic_DialogDialogIa2WebIAccessible object at 0x0109D450>
Python class mro: (<class 'NVDAObjects.Dynamic_DialogDialogDialogIa2WebIAccessible'>, <class 'NVDAObjects.behaviors.Dialog'>, <class 'NVDAObjects.IAccessible.ia2Web.Ia2Web'>, <class 'NVDAObjects.IAccessible.IAccessible'>, <class 'NVDAObjects. window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'documentBase.TextContainerObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <class 'garbageHandler.TrackedObject'>, <class 'object'>)
description: ''
location: RectLTWH(left=0, top=1056, width=0, height=0)
value: None
TextInfo: <class 'NVDAObjects.IAccessible.IA2TextTextInfo'>
appModule: <'chrome' (appName 'chrome', process ID 6956) at address 9bd4a30>
appModule.productName: 'Google Chrome
appModule.productVersion: '104.0.5112.81'
appModule.helperLocalBindingHandle: c_long(143942656)
windowHandle: 12060604
windowClassName: 'Chrome_WidgetWin_1' windowClassName: 'Chrome_WidgetWin_1
windowControlID: 0
windowStyle: 399441920
extendedWindowStyle: 256
windowThreadID: 18272
windowText: 'Download WinRAR 6.11 for Windows x64 in English - Google Chrome' windowText: 'Download WinRAR 6.11 for Windows x64 in English - Google Chrome
displayText: ''
IAccessibleObject: <POINTER(IAccessible2) ptr=0x89983bc at 10a31c0>
IAccessibleChildID: 0
IAccessible event parameters: windowHandle=12060604, objectID=-4, childID=-1717
IAccessible accName: 'Download complete: winrar-x64-611en.exe. Press Shift+F6 to scroll to the download bar area.'
IAccessible accRole: ROLE_SYSTEM_ALERT
IAccessible accState: (0)
IAccessible accDescription: ''
IAccessible accValue: ''
IAccessible2 windowHandle: 12060604
IAccessible2 uniqueID: -1717
IAccessible2 role: ROLE_SYSTEM_ALERT
IAccessible2 states: IA2_STATE_OPAQUE (1024)
IAccessible2 attributes: 'explicit-name:true;class:View;'
IAccessible2 relations:

In my add-on module I have this:

    def event_NVDAObject_init(self, obj):
        if obj.role == getRole("ALERT"):
            if obj.IAccessibleObject.accName(obj.IAccessibleChildID).split()[0] == _("Download"):
braille.handler.message(obj.IAccessibleObject.accName(obj.IAccessibleChildID)).

Well what I want is to send to the braille line the message that the download is finished.

This message for deaf blind people is important to know when the download is finished because the braille line does not inform by default of this message.

Well with the above I only get the download status message and if I take everything out of the if and just leave:

    def event_NVDAObject_init(self, obj):
print(obj.IAccessibleObject.accName(obj.IAccessibleChildID))

Well, sometimes I get the message back and sometimes I don't, testing with the same download every time.

The truth is that I am lost.

Can someone clear me doubts or do it in another way?

Thank you very much in advance.

Best regards.


Translated with www.DeepL.com/Translator (free version)

Join nvda-addons@nvda-addons.groups.io to automatically receive all group messages.