Get List of Open Chrome Tabs .NET

0 Flares Filament.io 0 Flares ×


Before Google Chrome version 32, obtaining a list of open tab titles was somewhat trivial. Each tab was it’s own “Window” and had it’s own handle. So you could use that handle and obtain the title via the window caption. When Google Chrome updated to version 32, a lot happened behind the scenes with regards to UI rendering. (see here for more details).

With the v32 update, using the method mentioned above you can only obtain the current open tabs title. No good. If we want a list of all open tabs, we have to do something different. In this case, it’s using the somewhat recent UI Automation accessibility framework. This framework allows you to treewalk through an applications UI, find and interact with majority of it’s interface elements.

Finding the tabs

To browse and treewalk through UI elements of an application, you can use the inspect tool by Mirosoft found in the Windows Developer Kit. As you can see from the screenshot below, the main caption of our parent “Google Chrome Window” is the active tab title.


The Code

To get list of open Chrome Tabs and to utilise UI Automation you’ll need to add a couple of references to your project;


Located in; C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 (or 3.5)


C# (Thanks to Steve Greene in comments)

Example Project / Github Repo

The code snippet above has one downfall, it only seems to grab a single Chrome window’s tabs. So if you have multiple Chrome windows open, it’ll just grab the last active set of tabs. I’ve uploaded a project to Github that fixes this issue and gets all open Chrome windows tab titles. Github Repo.


UI Automation is pretty neat. Getting the UI element title or caption is only just scratching the surface. For example it’s possible to interact with the elements such as click on buttons, set values and much more. I’ve worked quite a bit with windows and manipulating them via their handles, but being able to drill down deeper to individual UI elements will definitely come in handy.

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Reddit 0 Filament.io 0 Flares ×