1

I am trying to start opera(v 36.0) using selenium 2.53.0 and Opera chromium driver _win64 (0.2.2).

When I try to run sample code, an exception occurred and browser didn't started.

Sample code:

            File pathToOpera = new File("E://operadriver.exe");
            DesiredCapabilities cap = DesiredCapabilities.operaBlink();
            cap.setCapability("webdriver.opera.driver",pathToOpera);
            driver = new OperaDriver(cap);

I am getting error as

java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.opera.driver system property; for more information, see https://github.com/operasoftware/operachromiumdriver. The latest version can be downloaded from https://github.com/operasoftware/operachromiumdriver/releases
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
at org.openqa.selenium.opera.OperaDriverService.access$0(OperaDriverService.java:1)
at org.openqa.selenium.opera.OperaDriverService$Builder.findDefaultExecutable(OperaDriverService.java:118)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.opera.OperaDriverService.createDefaultService(OperaDriverService.java:82)
at org.openqa.selenium.opera.OperaDriver.<init>(OperaDriver.java:137)

My execution environment: win 8, 64 bit

ajesh
  • 91
  • 12
  • Does it work with other version of opera driver ??? – SkorpEN Apr 29 '16 at 08:00
  • Did You set webdriver.opera.driver system property ??? Exception just said that it is not set. – SkorpEN Apr 29 '16 at 08:00
  • @SkorpEN : I tried for 32 and 64 bit type, but not in a different version. In above added code, I set driver path in desiredCapability as well I tried by setting 'System.setProperty("webdriver.opera.driver", pathToOpera)'. But that didn't worked. – ajesh Apr 29 '16 at 08:09

1 Answers1

1

Add before Your code:

System.setProperty("webdriver.opera.driver","E://operadriver.exe");
System.setProperty("opera.binary","E://yourOperaPath.exe");
SkorpEN
  • 2,491
  • 1
  • 22
  • 28
  • 1
    Added below code and still getting error. System.setProperty("webdriver.opera.driver", "E://operadriver.exe"); File pathToOpera = new File("C:/Users/ajesh.ks/AppData/Local/Programs/Opera/launcher.exe");DesiredCapabilities cap = DesiredCapabilities.operaBlink(); cap.setCapability("opera.binary",pathToOpera); driver = new OperaDriver(cap); I am getting below error : Starting OperaDriver 0.2.0 (ba47709ed9e35ce26dbd960fb5d75be104290d96) on port 29660 Only local connections are allowed. org.openqa.selenium.WebDriverException: unknown error: cannot find Opera binary – ajesh Apr 29 '16 at 10:14
  • It is different error. Now set up System path to opera.binary correctly. – SkorpEN Apr 29 '16 at 10:22
  • I have uninstalled my previous installation path(AppData) and installed to default location. Also ([link]https://sny.no/2011/10/capabilities) removed desired capability set 'opera.binary'. Further to that, Opera browser started successfully, but **Console window crashes** in background. Without close of window, further driver commands are not executed. Each time driver instantiated, console window and Browser opens and console crashed. – ajesh Apr 29 '16 at 11:39
  • check with older versions(browser or driver), maybe the newest got some issues. – SkorpEN Apr 29 '16 at 12:38
  • It's strange that, opera driver unable to pick path values though its added in system path. I have tried with Opera launcher (v.36) and driver (v.0.2.0) in win 8 platform. But still **Console Host** window opened in background and crashed. – ajesh Apr 29 '16 at 20:13
  • I tried same combinations of Opera binary and driver in Win 10, 64 bit platform, that successfully started Opera browser and Console window opened without a crash. I hope that might be a platform issue. Am concerned about binary behavior of opera, how to alter default installation path. – ajesh Apr 29 '16 at 20:21