I use Selenium WebDriver in Java and I need to configure Safari and Opera browsers. For Opera almost work properly but I need to set Binary

System.setProperty("webdriver.opera.driver", dirPath + "\\src\\test\\resources\\operadriver64.exe");
OperaOptions op = new OperaOptions();
op.setBinary(new File("D:\\Program Files\\Opera\\47.0.2631.55\\opera.exe"));
driver = new OperaDriver(op);

Is it possible to skip line setBinary and still working?

Second question is about Safari web browser. I use this code:

System.setProperty("webdriver.safari.driver", dirPath + "\\src\\test\\resources\\SafariDriver.safariextz");
driver = new SafariDriver();

and occurs error org.openqa.selenium.WebDriverException: SafariDriver requires Safari 10 running on OSX El Capitan or greater. Is it possible to run tests on windows 7 using Safari?

  • 1
    Safari for windows is long dead. I doubt you have any way to use Selenium with Safari on any system other than a Mac. For Opera, try the suggestions here: github.com/operasoftware/operachromiumdriver/blob/master/docs/…
    – Kate Paulk
    Aug 21, 2017 at 14:25
  • but maybe it's possible to setup old version of Safari? Aug 22, 2017 at 7:36
  • It is possible, but since the most recent version of Safari for Windows is Safari 5, and the WebDriver requires Safari 10, it won't help you.
    – Kate Paulk
    Aug 22, 2017 at 12:22

3 Answers 3


Safari: Let's get this one out the way. Like fellow contributors already commented below your question, testing Safari on Windows will be an uphill battle since Apple basically dropped this configuration. Since you won't likely be able to run and test the latest Safari browser on Windows, you're just better off setting up a MacOS/Safari node in your Selenium grid and roll with that.

Opera: As far as I know, your code to set up the opera driver is perfectly correct and in compliance with what Selenium's API documentation actually requires. You do need an OperaOptions instance, a call to setBinary() and then use that instance as an argument in your OperaDriver constructor. See this link for proof:


As a confirmation, here's a code sample from my (Java) WebDriver factory for Opera. It's very much like yours, and like what Selenium's API documentation recommends:

case Opera:
    System.setProperty("webdriver.opera.driver", "C:\\Program Files\\Selenium\\Browser Drivers\\operadriver\\operadriver.exe");
    //System.setProperty("opera.binary", "C:\\Program Files\\Opera\\48.0.2685.32\\opera.exe");

    OperaOptions options = new OperaOptions();
    options.setBinary(new File("C:\\Program Files\\Opera\\48.0.2685.32\\opera.exe"));

    driver = new OperaDriver(options);

Also: Always make sure your Opera browser is compatible with the driver executable you're using.


With an earlier version of selenium 2.11 we had option OperaDriverSettings object to set opera binary path

OperaDriverSettings settings = new OperaDriverSettings();
WebDriver driver = new OperaDriver(settings);

Since around selenium 2.15, the OperaDriverSettings object doesn't exist..

another option is Setting OPERA_PATH as an environment variable but it is not working for me.

so i think when you open opera browser with selenium you must need to set binary path as follow

    System.setProperty("webdriver.opera.driver","path to opera driver.exe");
    OperaOptions options = new OperaOptions();
    options.setBinary(new File("path to opera binary"));
    OperaDriver driver = new OperaDriver(options);
    WebDriver webDriver = driver;

if you remove set binary code line you will get "org.openqa.selenium.WebDriverException: unknown error: cannot find Opera binary" error


Check selenoid framework. You don't need to show drivers for different browsers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.