1

I wonder if, and how, it's possible to enumerate all open instances of Chrome..
So let's I have 1 instance of Chrome running with 3 tabs. Stackoverflow, google and youtube.
Is it possible to retrieve that data so you can use the information on that page?

I know how to pull info of a page I just want to know how to get the active chrome windows and pages.

Any ideas?

I've googled on this problem and found some info on delphi.about.com

I tried it out but it didn't do much, it only showed the instances of explorer.exe.

Any help will be much appreciated.
Thanks in advance.

Edit: I'm using Chrome version: 36.0.1985.125.

Teun Pronk
  • 1,367
  • 12
  • 24
  • You want to do this just for chrome? – David Heffernan Sep 19 '14 at 07:51
  • @DavidHeffernan Well it is my default browser. But if it works for other browsers too thats fine. It's not a requirement to be Chrome specific. – Teun Pronk Sep 19 '14 at 07:55
  • I guess you first of all need to list all the browsers that you wish to support – David Heffernan Sep 19 '14 at 07:56
  • @DavidHeffernan Like I said I use chrome, so that's what i'm after. I just meant that if there is a solution that works on chrome but it also works on firefox that's fine. The goal is to have it work with chrome one way or another. – Teun Pronk Sep 19 '14 at 07:58
  • [Getting the current tab's URL from Google Chrome using C#](http://stackoverflow.com/questions/18897070/getting-the-current-tabs-url-from-google-chrome-using-c-sharp) and [Enumerate browser tabs from external application](http://stackoverflow.com/questions/1112598/enumerate-browser-tabs-from-external-application) – bummi Sep 19 '14 at 07:59
  • I recommend that you ask that then. Because there's be a different solution for each browser. – David Heffernan Sep 19 '14 at 08:00
  • @DavidHeffernan Edited the question. Thanks for that, I had no idea it would be different for each browser. – Teun Pronk Sep 19 '14 at 08:02
  • How are you pulling info out of a page at the moment? – David Heffernan Sep 19 '14 at 08:03
  • Well right now I create a TWebbrowser that navigates to the page I need and I simply extract the source from that page. – Teun Pronk Sep 19 '14 at 08:04
  • That's a weak way to do it surely. Can't you get the info from the browser? – David Heffernan Sep 19 '14 at 08:05
  • Listen to HTTP communication behind. It's naive to believe you'll find a way to support all browsers. – TLama Sep 19 '14 at 08:06
  • @DavidHeffernan Well that is what I want to do but I don't know how to get the browser. Which is why I asked this question ;) – Teun Pronk Sep 19 '14 at 08:06
  • @TLama I dont believe I will find a way. I have no idea what the possibilities are, so when David asked me what browser it was for I said the focus is on Chrome but if it works for other browsers too that would be fine aswell. – Teun Pronk Sep 19 '14 at 08:07
  • Wishful thinking that you can have one solution fits all by browser automation. Which version of Chrome do you require support for? How you do this depends on the Chrome version. You must include a Chrome version in your question. – David Heffernan Sep 19 '14 at 08:08
  • @David, I believe you are thinking of the UI automation. Well, Chrome supports it, but you must enable it first. And that might not be feasible for spyware :-) – TLama Sep 19 '14 at 08:14
  • @TLama You are right – David Heffernan Sep 19 '14 at 08:24
  • @TeunPronk Chrome extension may well be easiest way to go – David Heffernan Sep 19 '14 at 08:24
  • @DavidHeffernan Thanks, are there any examples you know off that I can take a look at? – Teun Pronk Sep 19 '14 at 08:36
  • I'm sure there are. Websearch would be the way to go. – David Heffernan Sep 19 '14 at 08:42
  • You might achieve this using same approach as it is shown on delphi.about.com page you refered to. Now the code shown there simply enumerates all shell windows and then checks to see if specific window is of specific interface which is in case of Internet Explorer is declared as iWebBrowser2. So basically for chrome or other browsers you need to find the interface structure that thir windows use and then test all enumerated windows to see if they are of that Interface. – SilverWarior Sep 19 '14 at 10:08
  • @SilverWarior Why would other browser windows support any interfaces at all? – David Heffernan Sep 19 '14 at 10:38
  • Well why not? Anywhay after some browsing I see that google chrome has its own APi that you can use for this. You can find more info on it here: https://developer.chrome.com/extensions/windows – SilverWarior Sep 19 '14 at 11:08
  • @SilverWarior My program's main window doesn't support any interfaces that can be queried for. IE is unusual in exposing interfaces like that. It is not the norm. – David Heffernan Sep 19 '14 at 11:59

0 Answers0