thisisdude
thisisdude

Reputation: 576

Not able to automate Opera browser through Selenium WebDriver

I'm automating a web application which runs in 3 browsers, IE, Mozilla and Chrome.

Now when I try to run the same code in Opera with different capabilities, it opens Opera browser but in URL only data; is displayed and my tests are not running.

Here is my sample code:

DesiredCapabilities capabilities = DesiredCapabilities.operaBlink();
                System.setProperty("webdriver.opera.driver", "C:\\Important\\Test\\web\\src\\test\\resources\\operadriver.exe");
                driver = new OperaDriver(capabilities);
                driver.manage().window().maximize();

I'm getting following error:

org.openqa.selenium.WebDriverException: Opera not reachable   (Driver info: OperaDriver=0.2.0 (ba47709ed9e35ce26dbd960fb5d75be104290d96),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)

Upvotes: 0

Views: 1318

Answers (2)

prakash krishnan
prakash krishnan

Reputation: 831

I tried this with Windows 10, Selenium 3.5.2, Opera 52.0 and OperaDriver 2.35 and the following code works for me.

    DesiredCapabilities capablities=DesiredCapabilities.opera();
    System.setProperty("webdriver.opera.driver", "C:\\automation\\opera\\operadriver.exe");
    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.setBinary("C:\\Program Files\\Opera\\launcher.exe");
    capablities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
    OperaDriver driver = new OperaDriver(capablities);
    driver.get("https://www.google.com");
    driver.findElement(By.name("q")).sendKeys("how to use opera with selenium");    

Upvotes: 1

Syagin Kumar
Syagin Kumar

Reputation: 19

Please Try with

DesiredCapabilities capabilities = DesiredCapabilities.opera();

Upvotes: 0

Related Questions