If we pass chromedriver.exe for webdriver.gecko.driver , it works and opens chrome browser.
Meta -
OS: Windows 10
Selenium Version: 3.0.1
Browser: Firefox
Browser Version: 48.0.1
Expected Behavior - I am expecting some exception because I am passing wrong property value.
Actual Behavior - It is opening browser.
Steps to reproduce -
- Add .exe files for chrome and firefox browser in same folder.
- Pass chromedriver.exe for the key webdriver.gecko.driver. (Actually I should pass geckodriver.exe but i passed wrong one).
- Write code as WebDriver driver= new FirefoxDriver()
Please go to below link to get more details: https://drive.google.com/open?id=0B72MKIHK8VOnOGotMGNyUXQxeGs
if anything you should log a bug with chromedriver, so that if it gets a BrowserName that doesn't equal 'chrome' then it shouldn't launch the browser. The selenium project just attempts to launch the executeable and the request a new session from it. The problem here is that chromedriver readily accepts the new session request for "firefox", but it shouldn't.
Please log a bug with https://bugs.chromium.org/p/chromedriver/issues/list
We are not going to put in extra code in the selenium project to match the requested Desired capabilities with the resultant session created. In fact grid is done in such a way that you could get a different browser than originally requested, depending on how one configures it. You may certainly attempt to add to your code to check the responding Capabilities and check to ensure they match your expected result.