I have found the solution running opera 25+ using OperaChromiumDriver.exe.
- Install Opera 25+ (I installed Opera 25)
- Download OperaChromiumDriver https://github.com/operasoftware/operachromiumdriver/releases
- Extract the zip file to a location on the computer
Use the following code to open Opera
System.setProperty("webdriver.chrome.driver", "C:/Users/user/Downloads/operadriver-0.1.0-win32/operadriver-0.1.0-win32.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
driver.findElement(By.name("q")).sendKeys("Selenium");
I have used new ChromeDriver()
. This will start Opera since we are using OperaChromiumDriver
. I think this is because the new Opera is based on Chromium and OperaChromiumDriver is a WebDriver implementation derived from ChromeDriver [See https://github.com/operasoftware/operachromiumdriver].
Hope this helps you.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…