2

So I was trying to figure out how to get the Text/Title of the google chrome browser. I finally got to this, which looked promising..

cur_url = Process.GetProcessesByName("chrome")[0].MainWindowTitle;

cur_url is a string which will old the name. Sadly this does not work. it just returns a blank value. Is this the correct way to do this? Or is there another, more efficient way?

Thanks.

Duncan Palmer
  • 2,865
  • 11
  • 63
  • 91
  • What happens when there are multiple instances of the browser running? Or multiple tabs? Which title do you want to retrieve? – Cody Gray - on strike May 13 '12 at 09:59
  • Even if When single instance of "Google Chrome" runs it opens up multiple instances of "chrome.exe" [See Image](http://i.imgur.com/22dZw.png)..So, this way it wont work! You cant know which instance is the correct one! – Writwick May 13 '12 at 10:18

1 Answers1

0

Take a look of this answer:

Get chrome browser title using c#

It will work for you. you need to use Win32Api for this.

Community
  • 1
  • 1
Dor Cohen
  • 16,769
  • 23
  • 93
  • 161