One possible logic is that
- First defect what system's default browser is
- Then in your Selenium code, use a switch, like
browser = get_default_browser_name()
if browser = firefox
then launch firefox
if browser = chrome
then launch chrome
if browser = ie
then launch ie
The first step could be tricky, it's possible for C# on Windows from registry. Not sure about how to code it in Python or how to deal with other systems like Linux/Mac.
However, your idea won't work as intended after all, because Selenium version needs to match the browser version.
For example, if you have Selenium 2.40.0 in your program, but some users use Firefox Nightly (which is FF30), then it won't work, because Selenium doesn't support FF30 at the moment.
Same for Chrome, different versions of ChromeDriver support different versions of Chrome. How could you know which ChromeDriver you need to include? ChromeDriver 2 supports Chrome from 27 and above, each of them has more specific version requirements, see release notes here. What if someone uses Chrome 26 or under? More trouble.
I would suggest you to include you own portable Firefox, then specify binary location when launch browser.
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('path/to/binary')
driver = webdriver.Firefox(firefox_binary=binary)