How to use OperaChromiumDriver for opera version >12.X

后端 未结 3 2173
暖寄归人
暖寄归人 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:21

    I have found the solution running opera 25+ using OperaChromiumDriver.exe.

    1. Install Opera 25+ (I installed Opera 25)
    2. Download OperaChromiumDriver https://github.com/operasoftware/operachromiumdriver/releases
    3. Extract the zip file to a location on the computer
    4. Use the following code to open Opera

      System.setProperty("webdriver.chrome.driver", "C:/Users/user/Downloads/operadriver-0.1.0-win32/operadriver-0.1.0-win32.exe");
      WebDriver driver = new ChromeDriver();
      driver.get("https://www.google.com");
      driver.findElement(By.name("q")).sendKeys("Selenium");
      

    I have used new ChromeDriver(). This will start Opera since we are using OperaChromiumDriver. I think this is because the new Opera is based on Chromium and OperaChromiumDriver is a WebDriver implementation derived from ChromeDriver [See https://github.com/operasoftware/operachromiumdriver].

    Hope this helps you.

提交回复
热议问题