yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Using Accessibility Inspector on Mac OS X


4m read
·Nov 3, 2024

Hey guys, this is Macad 101, and today I'm going to be showing you about a really cool application which comes built into Xcode called Accessibility Inspector.

This application lets you basically analyze the guts of an application's user interface and see exactly what that app is doing and how it's laying out all its UI components.

So the first thing I'm going to do is show you how to open up Accessibility Inspector. You have to have Xcode installed, but if you do, you should just be able to go into Spotlight, type "Accessibility Inspector," hit enter, and here it will appear. If that doesn't work for whatever reason, you can always open up Xcode yourself, go up to Xcode in the corner, open Developer Tool, and click on Accessibility Inspector from there, and it'll come right up.

Now that we've gotten Accessibility Inspector open, I'm going to be showing you how to use it to kind of analyze the user interface of Safari. So I have Safari open here just to, you know, google go.com, and what you'll notice is whenever I move my mouse around on this web page, Accessibility Inspector appears to be going nuts. You know, it's changing everything when I... but if I don't move my mouse, it stays still.

But the second I start moving it, it’s going nuts. What it's actually showing here is the hierarchy of the application. To explain what this is a little better, you might consider an application as a set of different levels. At the top level, you've got a window, and that contains everything. Then under the window, you might have a toolbar, which contains some buttons, and then, you know, it might contain a text box, and inside of that, there might be a button.

So you can picture how a hierarchy could kind of have multiple layers. That’s how Safari works, and that's how pretty much every application works. You have these layers, and this hierarchy is showing us the layers of UI components in an application. The attributes are telling us specific things about the exact lowest level component that we're hovering over.

So in this case, I'm hovering over a downloads button, and yeah, that might be inside a window or a toolbar, but the attributes showing is just for the button itself. So it's kind of annoying that it keeps changing whenever I move my mouse.

To lock it into a specific element, all we have to do is hit Command + F7, and now we can have a look at the properties of this button. We can see exactly where the button is because there's a little rectangle around it now. But we can also look at the hierarchy, and we can see that this button is inside of a toolbar, and that toolbar is inside of a window—presumably this full window—and the window is inside of an application, which I assume is Safari.

So instead of looking at the button, now let's go up the hierarchy and look at the toolbar. You can now see the toolbar is actually this entire top part. It includes all these buttons, but it doesn't include the tab bar. We could not have been able to figure out any of this information if it weren't for Accessibility Inspector because visually it's kind of hard to tell. You know, the tab bar and the toolbar are the same color and everything, but what this allows us to do is let us see that this is, you know, internally a separate part of the application.

But we just went up the hierarchy; we went from a button to its parent. We can also do the opposite and go from this toolbar to anything that's inside of it. So under attributes, we've got accessibility children, and this is everything underneath the toolbar.

So how about we go to this first ax group? You can see that it is these buttons left and right, and they actually have a children which is another ax group, which is just a smaller thing. You know, that doesn't seem very efficient, but I'm sure they have a reason for it. Then under that, we have two buttons, presumably the left button and the right button.

So that's just an example of how to go around the hierarchy. To unlock this, to get back into the mode where we can just move our mouse around, we just hit Command + F7 again. Now let's just take a quick look at how about the Google logo on Google's web page. We actually can find out a great deal about it.

So Accessibility Inspector tells us the URL of this image; you know, it tells us where the Google logo is located on the internet. We can also see that it's inside of a web area, which is Apple's UI component for displaying web pages.

Of course, we can see that it's inside of all these other things. I'm not entirely sure what these other things are. You know, I haven't played around with looking as far as user interface hierarchy very much, but I just think it's extremely cool that we can do this, where we can extract the user interface of an application using Accessibility Inspector.

So anyway, I really hope you enjoyed seeing a little bit about Accessibility Inspector. I hope in the near future to make another video which will follow up on this, where I'll show you how to use the information you can get from Accessibility Inspector to actually write Apple Scripts that can automate various processes.

The reason Accessibility Inspector is helpful for this is because it can tell you about the structure of an application so that you know what to do in Apple Script to, you know, actually click on the right buttons and go to the right screens. Because you actually can look at the structure of the app, and then Apple Script can manipulate the structure of the app.

But anyway, look forward to that! I hope to make it soon. So thanks for watching Macad 101. Subscribe and goodbye!

More Articles

View All
An Infinite Dilemma of Bliss and Suffering
Imagine a universe filled with an infinite number of immortal people living in Bliss. They love it; it is awesome. But each day, one of them is removed and sent away to a separate Universe of suffering forever. Now, imagine a different Universe filled wi…
Jocko Willink and Mike Sarraille - Helping Veterans Transition into the Private Sector
Um, alright guys, well thanks for hosting me to a podcast at the Jocko podcast studio. For those of our listeners that don’t know about you guys, I think we should start with some quick intros and then start talking about the new program you’re working on…
Racing 800 Miles in the Desert—in a VW Bug | National Geographic
The Baja 1000 is just one of the toughest off-road races that exists. Uh, it’s in Baja California in Mexico down the peninsula. It’s pretty much the race that you aspire to do in off-road racing. This year’s event is 828 miles and has, I believe, a 33-hou…
How One Line in the Oldest Math Text Hinted at Hidden Universes
(dramatic music) - [Derek] A single sentence in one of the oldest math books held the key to understanding our universe. Euclid’s “Elements” has been published in more editions than any other book except the Bible. It was the go-to math text for over 2,00…
When you call the US Coast Guard - Smarter Every Day 265
Hey! It’s me, Destin. Welcome back to Smarter Every Day! I recently got to spend some time with the United States Coast Guard, and I gotta say, I was blown away. A lot of people don’t even know about the Coast Guard or think about the Coast Guard, but it’…
World's Lightest Solid!
This is aerogel. The world’s lightest, that is least dense, solid. This piece has a mass of just 1.22 grams. That is only a few times the mass of the same volume of air, which kind of makes sense because it is 99.8% air. In fact, some aerogels are so ligh…