1

Is there a way to copy the content from Google chrome’s active tab to a string / text file using C#-WPF?

Example: Say I have three sites are opened in Google chrome, (google.com, cnn.com & stackoverflow.com) and active tab is stackoverflow.com. The program should give me all the text (like if you do CTRL+A and CTRL+C).

I have found the way to get the active tab: Getting the current tab's URL from Google Chrome using C#

I have done similar with IE.

foreach (SHDocVw.InternetExplorer ieInst in new SHDocVw.ShellWindows())
{
  String url = ieInst.LocationURL;
    if (url.Contains(textBox1.Text))
    {
      ieInst.ExecWB(SHDocVw.OLECMDID.OLECMDID_SELECTALL, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT);
      ieInst.ExecWB(SHDocVw.OLECMDID.OLECMDID_COPY, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT);

      TextBox1.Paste();
    }
}
Community
  • 1
  • 1
Jo Varg
  • 11
  • 2

0 Answers0