0

I am trying to launch a site on the opera browser using the selenium java. I have tried the code below but I get an error that it is deprecated. Please I need update on how to go about this.

package donald;

// Importing All Necessary Items
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.opera.OperaDriver;

public class sweet-scrape {
    public static void main(String[] args)
    {
            // Set the path to the OperaDriver executable
            System.setProperty("webdriver.opera.driver", "C:\\Visual Studio\\WebScraper\\sweet-scraper\\drivers\\operadriver.exe");
        
            // Creating New Object driver Of Webdriver
            WebDriver driver = new OperaDriver();
        
            // Open the website
            driver.get("https://www.jiji.ng");
    }
}

These are the errors I get:

The type OperaDriver is deprecated The constructor OperaDriver() is deprecated

  • Share the actual error you got. – amycodes Jun 03 '23 at 22:46
  • These are the errors i get: The type OperaDriver is deprecated The constructor OperaDriver() is deprecated – donaldekpe Jun 03 '23 at 23:34
  • Edit your question to include them. – amycodes Jun 03 '23 at 23:36
  • I have included the error message in the question. – donaldekpe Jun 03 '23 at 23:39
  • 1
    Opera isn't supported at all by Selenium anymore. Instead you'll probably want to use Opera's [version of the Chrome webdriver](https://github.com/operasoftware/operachromiumdriver), and may need to dig through some of the [related issues](https://github.com/operasoftware/operachromiumdriver/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+java) to get it to work in Java. – Zac Anger Jun 03 '23 at 23:44

0 Answers0