Topics

Getting the URL of the current web page in Chrome or Firefox

Jamal Mazrui
 

Apologies if this has been discussed recently (I had trouble keeping up with the message volume so had to unsubscribe months ago).


Can anyone give code that enables an add-on to reliably get the URL of the current web page opened in Chrome ore Firefox?  Before NVDA moved to Python 3, I had working code that searched from the top of the accessibility tree, looking for the "value" attribute of the first object with a role of "editabletext".  That code no longer works, and I'm not sure whether the cause has been a change in the NVDA or browser APIs (the same code previously worked in both Chrome and Firefox).


I have searched for other objects in the accessibility tree that might contain the URL in an attribute, without success.  I have also considered using the findWindow function of a builtin NVDA module, but I have not been able to identify a window containing the URL information when a browser window is active.


Jamal

Alberto Buffolino
 

Jamal Mazrui, il 30/07/2020 19.31, ha scritto:
Can anyone give code that enables an add-on to reliably get the URL of the current web page opened in Chrome ore Firefox?
Alberto:
Hi Jamal,
in 2019 I discovered a method that seems still working. I tested in Firefox simply from Python console (where nav is the main web document):
***
from comtypes.gen.ISimpleDOM import ISimpleDOMDocument
doc = nav.IAccessibleObject.QueryInterface(ISimpleDOMDocument)
doc.URL
***
Compatible with Chrome (tested in 2019) and Firefox, and probably Edge at this time.
Alberto

Ralf Kefferpuetz
 

-----Original Message-----
From: nvda-addons@nvda-addons.groups.io <nvda-addons@nvda-addons.groups.io> On Behalf Of Jamal Mazrui
Sent: Donnerstag, 30. Juli 2020 19:31
To: nvda-addons@groups.io
Subject: [nvda-addons] Getting the URL of the current web page in Chrome or Firefox

Apologies if this has been discussed recently (I had trouble keeping up with the message volume so had to unsubscribe months ago).


Can anyone give code that enables an add-on to reliably get the URL of
the current web page opened in Chrome ore Firefox? Before NVDA moved to
Python 3, I had working code that searched from the top of the
accessibility tree, looking for the "value" attribute of the first
object with a role of "editabletext". That code no longer works, and
I'm not sure whether the cause has been a change in the NVDA or browser
APIs (the same code previously worked in both Chrome and Firefox).


I have searched for other objects in the accessibility tree that might
contain the URL in an attribute, without success. I have also
considered using the findWindow function of a builtin NVDA module, but I
have not been able to identify a window containing the URL information
when a browser window is active.


Jamal

Jamal Mazrui
 

Thanks, Alberto -- that works in my script with both Chrome and Firefox.  Thanks for your reply as well, Ralph.


Jamal

On 7/30/2020 12:18 PM, Alberto Buffolino wrote:
Jamal Mazrui, il 30/07/2020 19.31, ha scritto:
Can anyone give code that enables an add-on to reliably get the URL of the current web page opened in Chrome ore Firefox?
Alberto:
Hi Jamal,
in 2019 I discovered a method that seems still working. I tested in Firefox simply from Python console (where nav is the main web document):
***
from comtypes.gen.ISimpleDOM import ISimpleDOMDocument
doc = nav.IAccessibleObject.QueryInterface(ISimpleDOMDocument)
doc.URL
***
Compatible with Chrome (tested in 2019) and Firefox, and probably Edge at this time.
Alberto

Eilana Benish
 

Hi Jamal
If I understand correctly your question
• For Mozilla Firefox you can use the Mozilla apps enhancements addon
• To copy the URL you can press NVDA + A twice
• For Google Chrome you can press F6 until you reached the address bar and then Press CTRL + C to copy the URL from the address bar







ובכבוד רב | Sincerely,
אילנה בניש מורשה נגישות שירות 2200 | Eilana Benish, service Accessibility authorized (2200)
ניהול פרויקטים – נגישות ושמישות אינטרנט וטכנולוגיות מידע | Projects manager – Accessibility & usability on internet and ICT
📱 +972-50-7100367 | 📧 benish.ilana@...

-----Original Message-----
From: nvda-addons@nvda-addons.groups.io <nvda-addons@nvda-addons.groups.io> On Behalf Of Jamal Mazrui
Sent: Thursday, July 30, 2020 8:31 PM
To: nvda-addons@groups.io
Subject: [nvda-addons] Getting the URL of the current web page in Chrome or Firefox

Apologies if this has been discussed recently (I had trouble keeping up with the message volume so had to unsubscribe months ago).


Can anyone give code that enables an add-on to reliably get the URL of
the current web page opened in Chrome ore Firefox? Before NVDA moved to
Python 3, I had working code that searched from the top of the
accessibility tree, looking for the "value" attribute of the first
object with a role of "editabletext". That code no longer works, and
I'm not sure whether the cause has been a change in the NVDA or browser
APIs (the same code previously worked in both Chrome and Firefox).


I have searched for other objects in the accessibility tree that might
contain the URL in an attribute, without success. I have also
considered using the findWindow function of a builtin NVDA module, but I
have not been able to identify a window containing the URL information
when a browser window is active.


Jamal