How to use OperaChromiumDriver for opera version >12.X

后端 未结 3 2209
暖寄归人
暖寄归人 2020-12-19 15:09

I understand that to work on opera versions > 12.X, Operachromiumdriver has been developed. At the same time I couldn\'t get this to work. I downloaded the windows version o

3条回答
  •  星月不相逢
    2020-12-19 15:29

    Operachromiumdriver

    Download selenium Drivers. As their is no direct opera driver, OperaChromiumDriver is based on ChromeDriver, so we are Using ChromeOptions to set binary location of operadriver.exe

    Chromium-based versions of Opera starting from version 26.

    String operaChromiumDriver = "E:\\Drivers\\operadriver.exe";
    String operaBrowserLocation = "C:\\......\\opera.exe"
    
    System.setProperty("webdriver.opera.driver", operaChromiumDriver);
    
    ChromeOptions options = new ChromeOptions();
    options.setBinary(operaBrowserLocation);        
    
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    OperaDriver browser = new OperaDriver(capabilities);
    
    WebDriver driver =browser;
    driver.get("https://in.yahoo.com/");
    

    thanks to Lukus Answer(1) to complete my work.

提交回复
热议问题