Opera WebDriver wont launch Opera (Selenium 3.1.0) Opera WebDriver wont launch Opera (Selenium 3.1.0) selenium selenium

Opera WebDriver wont launch Opera (Selenium 3.1.0)


I was able to run my tests in Opera 46, Windows 10 in the following way for webdriver 3.4.0 (local run):

System.setProperty("webdriver.chrome.driver", "operadriver.exe");ChromeOptions options = new ChromeOptions();options.setBinary("C:\\Program Files\\Opera\\46.0.2597.39\\opera.exe");DesiredCapabilities capabilities = new DesiredCapabilities();capabilities.setCapability(ChromeOptions.CAPABILITY, options);driver = new ChromeDriver(capabilities);


Not sure if you are still looking for an answer but here is how I achieve opera execution using selenium 3.3 in ruby lang.

Syntax
service = Selenium::WebDriver::Chrome::Service.new("<path to operadriver>", <any free port>, {optional so leave it blank})service.start

Eg:
service = Selenium::WebDriver::Chrome::Service.new("/usr/local/bin/operadriver", 12345, {})service.startcap = Selenium::WebDriver::Remote::Capabilities.chrome('operaOptions' => {'binary' => '/Applications/Opera.app/Contents/MacOS/Opera', 'args' => ["--ignore-certificate-errors"]})driver = Selenium::WebDriver.for(:remote, :url => service.uri, :desired_capabilities => cap)

There is a very similar method to do the same in java as well, but the steps or logic remain the same.
1) Start ChromeService on some free port
2) Start chrome remote caps but pass binary of opera and --ignore-certificate-errors option
3) pass the url from service and caps to remote webdriver


Using Latest Selenium 3.13 and OperaDriver v2.37You can do it using:

string LibraryDir = new FileInfo((new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath).DirectoryName.Replace("%20", " ");OperaOptions ooptions = new OperaOptions();ooptions.BinaryLocation = @"C:\Program Files\Opera\54.0.2952.54\opera.exe";_Browser = new OperaDriver(LibraryDir, ooptions);

LibraryDir is the location of operadriver.exe (Nuget Package should install)BinaryLocation should point to the executable Opera Browser!