0

I'm trying to make an app, which could open a pdf file in a browser (Chrome) and search for a certain word automatically. However, I can't find anything about passing commands to Google from C# whatsoever.

Process process = new Process();
process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = "chrome";
process.StartInfo.Arguments = "console.log(\"TEST1\")";
process.Start();

I've tried running Chrome with StartInfo.FileName = "chrome", which went well. After that I thought I could add some Arguments: StartInfo.Arguments = "something" and that's where I ran into two problems:

  1. The browser takes the Arguments as a URL and tries to open it as a web page (which of course fails)
  2. I couldn't find the console command to run the search function in Chrome

Is there maybe some google API capable of this thing? Also please note that I'm not trying to use "search". I need the browser to literally focus on the word it found

If anyone here knows how to solve even one of these problems, I would be really grateful. Also this is my first question on StackOverflow (and I might have forgotten something) - I can give some additional info, if you ask

  • 1
    [Selenium](https://www.selenium.dev/) automates web browsers and is available as a NuGet package. Perhaps you could start there. If you run into a more specific issue, that might make a more suitable question. – madmonk46 Nov 11 '22 at 16:10
  • That's indeed interesting. Do I need to use some third-party software then? – Martin Míča Nov 12 '22 at 09:09

0 Answers0