How to open a local HTML file in a specified browser?

Ranorex Studio, Spy, Recorder, and Driver.
Posts: 32
Joined: Fri Jul 02, 2021 2:35 pm

How to open a local HTML file in a specified browser?

Post by QATest879 » Mon Sep 12, 2022 4:46 pm

I know how to launch an online URL in a specific browser, and I know how to launch a local HTML file from bin/debug in the default browser, but I'm not sure how to do both at once?

Here is an example of what I mean:

(This opens html_file.html in the default browser. And the working directory is the bin/debug folder in the Ranorex project. I was able to get this working.

System.Diagnostics.Process.Start("Chrome.exe", "");
(This opens in the Chrome browser).

What I'm trying to do though is open a file from bin/debug (on my local drive) in the Chrome browser, regardless of the default browser. But if I do Process.Start() for a local file, it does not work, and it can't find html_file.html. So that is my question. If anybody knows the solution that would be appreciated. Thank you.