I am building a web scraping application using Selenium that will run on Windows desktops. I can assume the browser (Edge), but not the browser version (e.g. 90 or 91). I'm using JavaScript for ease of installation.
Before I instantiate Selenium, I need to determine the browser build (e.g. 90.0.818.46) so I can choose a compatible version of the WebDriver. I can use the amazing command line technique in how to get microsoft edge chromium version from command line or registry settings. However, I'd rather do this natively in JavaScript, ideally using the Windows Scripting Host interpreter. Node.js is also an option.
As described in the StackOverflow post mentioned above, in Python, I can query the registry directly. E.g.:
import winreg
keyPath1 = r"Software\Microsoft\Edge\BLBeacon"
key1 = winreg.OpenKey(winreg.HKEY_CURRENT_USER, keyPath1, 0, winreg.KEY_READ)
edgeVersion1 = winreg.QueryValueEx(key1, "version")[0]
Is there an equivalent approach in JavaScript?
I'm new to this so I'm open to other approaches to solve this use case.