First of all, you need to import the appropriate drivers into the project / class.
as
import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.ie.InternetExplorerDriver;
and etc.
You need to create new Webdrivers for the browser you need.
as
WebDriver driver = new FirefoxDriver(); WebDriver driver = new InternetExplorerDriver(); WebDriver driver = new ChromerDriver();
etc. for each browser.
Note: It is difficult to use different browsers / drivers in one test. Either you can use similar tests for each browser and support the test suite (i.e. use one driver and import in the test and support the same test for other browsers), or you can use some configuration files or Excel to choose which browser you want a test to run. You could study http://htmlunit.sourceforge.net/ for headless testing.
And information about OperaDriver can be found here: - https://github.com/operasoftware/operadriver/
some_other_guy
source share