Author Topic: Get Chrome Tab Info  (Read 5778 times)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Get Chrome Tab Info
« on: July 13, 2017, 01:42:24 PM »
I've overhauled the VA code and inline function (originally posted here) for obtaining Chrome tab information. The attached command will output a list of all the open Chrome tab titles (or names) as well as deduce the title and URL of the active tab that is currently open. This tab information will be pulled from the most recently accessed instance (window) of Chrome (it won't pull tab info from ALL open Chrome windows).
9
There are a few things to note.

FIRST: Chrome needs to be NOT MINIMIZED for the inline function to work properly. I've set the VA command to Maximize the most recent Chrome window but other non-minimized 'Display Window' configurations will also work.

SECOND: this method numbers the tabs based on the order in which they were opened in the browser. So if you move tabs around on the browser bar the tab numbering provided by VA will not correspond to the left-to-right order on the browser. But as long as you DON'T change the tab ordering during your instance of Chrome then you have the ability to reliably perform additional actions on the tabs and navigate through them with VA (like iceblast commented in the original post)...
Quote
...CTRL+1, CTRL+2, CTRL+3 and so on for (selecting) the tabs...CTRL+TAB and CTRL+SHIFT+TAB to cycle back and forth through the tabs as well...

THIRD: sometimes VA drags a bit when running this, but it does the job. These inline function code lines are what tend to slow down the command execution:
Code: [Select]
AutomationElement elemNewTab = rootElement.FindFirst(TreeScope.Subtree, condNewTab);
    AND
AutomationElement elmUrlBar = rootElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Address and search bar"));
My understanding is that these code lines search through the Chrome UI to find specific elements that can be used to obtain information or provide an anchor for additional processing. After exiting the VA "edit profile" mode I've found that the slowdown is less if you wait a 5-10 seconds before calling the command. Subsequent calls tend to be fairly responsive. I'm open to suggestions for how to improve the inline function speed.


Support This and Future Efforts
If you find this profile useful, please consider buying me a cup of coffee. Thank you for your support!
 


Cheers! :)
« Last Edit: June 02, 2020, 09:42:37 PM by Exergist »