System.setProperty("webdriver.chrome.driver", "operadriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("operadriver.exe");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
options.merge(capabilities);
_driver = new ChromeDriver(options);
I put the operadriver.exe in the project main path and i'm having this error :
AILED CONFIGURATION: @BeforeTest beforeTest org.openqa.selenium.WebDriverException: unknown error: Opera failed to start: was killed (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location operadriver.exe is no longer running, so OperaDriver is assuming that Opera has crashed.) (Driver info: OperaDriver=2.40 (a50783a565882ef2022bea655e8560f37ecf8afe),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 113 milliseconds Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z' System info: host: 'Z500W23694', ip: '10.8.79.91', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_92' Driver info: driver.version: ChromeDriver
Try below code to launch google.com using operaBrowser.
String operaBrowser = "C:\\......\\opera.exe"
System.setProperty("webdriver.opera.driver", "C:\\user\drivers\\operadriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary(operaBrowser);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
OperaDriver browser = new OperaDriver(capabilities);
WebDriver driver =browser;
driver.get("https://www.google.com/");