Re: Getting pages source from a browser window

Pawel Urbanski

While your add-on is useful to quickly check some infomration, such
debug information and more is found in every browser's developer
tools. This is also what all the developers use and therefore it is
useful to use it as well.
Chrome's tools are rather accessible, even with some obvious querks...
Every frontend team is using them, so unless you can plug in to such
process, you may have hard time to work with such teams and such teams
with you...

As for your case of getting styles. Styles are more than what is
defined. There is the css cascade and every element has soemthing
called calculated styles. Those are styles that are a combination of
rules applied directly by some class: for example setting a color, but
also rules applied higher up in the chain that for example set
padding, margins, and font-type and size of elements.

On 22/01/2020, James Scholes <james@...> wrote:
I don't believe this is possible. You can take a look at this thread
where I asked the same question 4.5 years ago, but the suggested
solution no longer works, and only ever worked in Chrome anyway:

If you want NVDA to have access to this sort of info, you'll need to
build a browser extension which works in tandem with your code on the
NVDA side (perhaps communicating via some sort of socket or other IPC
mechanism). That brings up all manner of questions about security and
performance, but is probably doable.

I suspect the sort of info you want to pull out of the browser is never
going to be useful to the majority of NVDA users, or necessary in order
to render web pages for users to read and navigate them. There are
limits to what an NVDA add-on can do on its own, and you've hit them.


James Scholes

On 21/01/2020 at 9:13 pm, Andy B. wrote:

I am trying to get the css classes from a page loaded in a browser
window while in an add-on. Does anyone know how to do this? When I
looked online for a possible answer, all of the libraries require the
location of an html file on the hard drive, or it requires a url.
However, my add-on has no knowledge of the url in the browser's address
bar, and I haven't found any easy way to get it either. Any suggestions?
My add-on will step to the next level if I can get to the css class
rules in the page.

Join to automatically receive all group messages.