Programming Language of choice is Java.
I have written a method in java, to which, i am passing the WebDriver as an argument…
public boolean myMethod(WebDriver webDriver, String option)
This method behaves differently if the browser type is Firefox or HtmlUnitDriver. Now withing this method how do i determine what is the browser type that i have instantiated for WebDriver?
One option that i have is to the method myMethod i should pass the browser type as well. Like…
public boolean myMethod(WebDriver webDriver, String option, String browser)
and during call
Myclass.myMethod(webDriver, “One”, “HT
You can use Java ‘instanceof’ operator to decide the driver type.