title: Chrome Path File Issue (Not Personal Issue) while using the Webbrowser Module
body: <p>So I recently wrote a small code to enter a specific URL using webbrowser module. And it worked on my PC. But when I ran the same code on my friend's PC, the webbrowser module failed to open Chrome. Here is my code:</p>
  <pre><code>import webbrowser
  
  url = 'https://pythonexamples.org'
  webbrowser.register('chrome',None,webbrowser.BackgroundBrowser(&quot;C://Program Files(x86)//Google//Chrome//Application//chrome.exe&quot;))
  webbrowser.get('chrome').open(url)
  </code></pre>
  <p>So on doing some research, we found out that the <strong>issue was with the Program Files(x86)</strong>. The reason why Chrome opened up on my pc is because the <strong>Google folder was stored in Program Files(x86) and Program Files on my friend's PC.</strong> So my intention is to create a solution for this so that my function runs on any pc without having to worry about this path issue.</p>
  <p>On googling we found this info:</p>
  <p><em>Starting soon, Google Chrome will install in the C:\Program Files\ folder by default on Windows if it is a 64-bit installer. Chrome 64-bit versions installed in the C:\Program Files (x86)\ folder will continue to work and will be updated just like before.</em></p>
  <p>So <strong>how do we create a code where first we can determine whether the Google folder is in Program Files or Program Files(x86) and then register the path file in webbrowser.BackgroundBrowser parameter</strong>. Any help would be appreciated.
  Thanks in Advance:)</p>
  <p>Update: My new code based on Markus Rosjat's solution</p>
  <pre><code>def get_executable(search_path, executeable_name):
      for sdir, dir, files in os.walk(search_path):
          if executeable_name in files:
              exe = files[files.index(executeable_name)]
              return os.path.join(sdir, exe)
  
  for path in [ 'C:\\program files',&quot;C:\\program files(x86)&quot;]:
      exe = get_executable(path, 'chrome.exe')
      if exe:
          url = f'https://{website}.com'
          webbrowser.register('chr', None, webbrowser.BackgroundBrowser(exe))
          webbrowser.get('chr').open(url)
  </code></pre>
  <p>The code isn't returning any thing as such.</p>