Hi, i am trying to execute selenium script in opera browser (Version 29) on Linux system but it shows like unknown Opera binary

2,781 views
Skip to first unread message

swamy narayanak

unread,
Jun 15, 2015, 5:26:43 PM6/15/15
to webd...@googlegroups.com
Hi sir, 
   when i am trying to execute my selenium script in Opera it shows following error summary

Code:
 System.setProperty("webdriver.opera.driver", "/home/pc-name/Downloads/operadriver");
   
   OperaDriver driver = new OperaDriver(); 
      driver.get("http://www.google.co.in/");

Error summary:
 Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Opera binary
  (Driver info: OperaDriver beta=0.1.498e0af382ca0283abd01832a17569991f2ecd52,platform=Linux 3.13.0-32-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.35 seconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'pc-name', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-32-generic', java.version: '1.7.0_65'
Driver info: org.openqa.selenium.opera.OperaDriver
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
 at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
 at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
 at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
 at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
 at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
 at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:171)
 at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:160)
 at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:117)
 at Operas.main(Operas.java:17)



Can you please help me

Thank You 
Narayana

darrell

unread,
Jun 16, 2015, 11:13:26 PM6/16/15
to webd...@googlegroups.com
First, you don't want to declare the variable as OperaDriver. The syntax should be:

Interface variable = new Implementation();

for example:

WebDriver driver = new OperaDriver();

By doing this, if I want to change from OperaDriver to some other implementation I just need to change this one line and the rest of my code will just work. This is just a good Java practice.

As for getting it working on Linux, is the Opera binary installed in /usr/bin? If no, can you add a symbolic link in the /usr/bin directory to where you have the Opera binary installed? If no, set the opera.binary property to the location of the binary.

Ashvini Sharma

unread,
Jun 25, 2015, 6:51:15 AM6/25/15
to webd...@googlegroups.com
Hi Narayana,

Use class WebDriver rather OperaDriver ::::
WebDriver driver = new OperaDriver(); 

Hope this should resolve your problem. If not, make sure that you have Opera file in your system any of following locations:
/usr/bin/opera
/usr/bin/opera-next
/usr/bin/operamobile

Thanks,
Ashvini

Sandeep Dharembra

unread,
Jan 25, 2016, 8:44:30 PM1/25/16
to webdriver
Hi,

I am getting the same exception on my ubuntu 14.04. I installed Opera version 12.11 as I read some where that versions 12 and older are supported. So far I have tried versions 0.2.0 and 0.1.0 of the Opera driver (version 0.2.2 doesn't work and gives driver error) from the below URL -

https://github.com/operasoftware/operachromiumdriver/releases

I have checked /usr/bin and it has the opera script. Have checked all the opera files and they have rx permissions for all users. Here  is the code and the exception I get -

System.setProperty("webdriver.opera.driver","/home/sandeep/Documents/Concepts/Selenium/operadriver");
System.setProperty("opera.binary", "/usr/bin/opera");
driver = new OperaDriver();

Starting OperaDriver beta (v 0.1.498e0af382ca0283abd01832a17569991f2ecd52) on port 7195
Only local connections are allowed.


org.openqa.selenium.WebDriverException: unknown error: cannot find Opera binary
  (Driver info: OperaDriver beta=0.1.498e0af382ca0283abd01832a17569991f2ecd52,platform=Linux 3.13.0-76-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 261 milliseconds
Build info: version: '2.49.1', revision: '808c23b0963853d375cbe54b90bbd052e2528a54', time: '2016-01-21 09:37:52'
System info: host: 'Sandeep-Latitude-E5540', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-76-generic', java.version: '1.8.0_66'

Driver info: org.openqa.selenium.opera.OperaDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
    at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:169)
    at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:158)
    at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:115)
    at TestChapter6.setUp(TestChapter6.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Krishnan Mahadevan

unread,
Jan 25, 2016, 11:27:23 PM1/25/16
to webdriver
Sandeep,

This is not the way, in which you set the binary property
System.setProperty("opera.binary", "/usr/bin/opera");


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at https://groups.google.com/group/webdriver.
For more options, visit https://groups.google.com/d/optout.

Sandeep Dharembra

unread,
Jan 26, 2016, 1:33:28 AM1/26/16
to webdriver
Thanks Krishnan for the help. It worked for me(although not with Opera 12.11 and I updated it to latest version). I used Opera options and added this line as per the link you suggested -

options.setBinary(new File("/usr/bin/opera"));

I was however hoping to make it work without using Opera options and hence even tried without specifying the opera binary path. I believe it should look in the some default locations (like /usr/bin/opera that I have) for the binary. The setBinary method should be used just in case you have the binary at some non default  location. Updating the Opera to latest and not specifying the binary path (i.e. don't using the options) has not worked either.

Sandeep

Krishnan mahadevan

unread,
Jan 26, 2016, 7:37:06 AM1/26/16
to webd...@googlegroups.com
In that case I would suggest that you set up debug breakpoints to understand where I the code looking at in terms of figuring out the default locations.
I don't have an opera installation available at my end to debug.

-Krishnan Mahadevan


"All the desirable things in life are either illegal, expensive, fattening or in love with someone else"

From: Sandeep Dharembra
Sent: ‎26-‎01-‎2016 12:03
To: webdriver
Subject: Re: [webdriver] Re: Hi, i am trying to execute selenium script inopera browser (Version 29) on Linux system but it shows like unknown Operabinary

Sandeep Dharembra

unread,
Jan 27, 2016, 5:50:03 AM1/27/16
to webdriver
Hi I am getting the same exception. I have installed version 12.11 of Opera on my ubuntu 14.04 LTS.

I have tried version 0.2.0 and version 0.1.0 of the driver from the below mentioned URL (Version 0.2.2) does not work

https://github.com/operasoftware/operachromiumdriver/releases




On Wednesday, 17 June 2015 08:43:26 UTC+5:30, darrell grainger wrote:

updesh jain

unread,
Mar 25, 2017, 8:31:04 PM3/25/17
to webdriver
Hi Sandeep,

I use windows system, I automation suite run on firefox, chrome and internet explorer.
Now i need to run on Opera browser.
Could you please let me know, which browser version and driver version i should use and piece of code to launch the opera browser.

Many Thanks in advance !!!

Sudeept Mohan

unread,
Nov 27, 2017, 11:41:59 AM11/27/17
to webdriver
Hi Ashvini,
I am running following code and yet receiving the same error, kindly recommend a suitable solution:

System.setProperty("webdriver.opera.driver", "C:\\Marionette\\operadriver_win32\\operadriver.exe");
WebDriver driver3 = new OperaDriver();
                driver3.get("https://duckduckgo.com/");

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Opera binary
  (Driver info: OperaDriver=2.32 (cfa164127aab5f93e5e47d9dcf8407380eb42c50),platform=Windows NT 10.0.15063 x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38 milliseconds
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:26.402Z'
System info: host: 'ADMIN-PC', ip: '192.168.1.6', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: OperaDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:140)
at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:173)
at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:160)
at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:115)
at packageFF.browserAutomation.main(browserAutomation.java:35)


Regards,
Sudeept
Reply all
Reply to author
Forward
0 new messages