You're the tester, so it's up to you to write code/scripts to explicitly test each of the various browser/version combinations and their various nuances and subtleties (whilst trying to reuse as much logic as you can, minimise duplication etc.)
The nature of WebDriver is that you, the tester, are doing the driving - not the browser. Don't try to detect things.
So given that you have different behaviour for IE and for Chrome, you should explicitly create a WebDriver
instance for each (in different @Test
s) and set up the required data (likewise properties, Capabilities
etc.) as appropriate.
By all means share common lookup code between the tests, but until your tests are robust and working you shouldn't try to refactor them.
driver
instances, why would they need code to work out the name so that only then could they switch on it? Where is the instance going to come from in the first place? – Koodoo