Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Selenium 4, update the Opera plug-in to automate Opera via ChromeDriver #282

Open
sbabcoc opened this issue Dec 6, 2024 · 3 comments

Comments

@sbabcoc
Copy link
Owner

sbabcoc commented Dec 6, 2024

Opera stopped releasing new builds of selenium-opera-driver back at version 4.4.0, recommending that people automate the Opera browser with selenium-chrome-driver instead. To make this work, the user will need to specify a couple of settings:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class OperaAutomation {
    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");

        ChromeOptions options = new ChromeOptions();
        options.setBinary("/path/to/opera");

        WebDriver driver = new ChromeDriver(options);

        driver.get("https://www.example.com");
        System.out.println("Title: " + driver.getTitle());

        driver.quit();
    }
}
@sbabcoc
Copy link
Owner Author

sbabcoc commented Dec 6, 2024

It may be possible to locate the browser binary by checking standard locations or searching the system file path. The standard locations vary by platform, which complicates this a bit.

@sbabcoc
Copy link
Owner Author

sbabcoc commented Dec 6, 2024

It may be possibly to eliminate the Opera plug-in entirely, revising the Chrome plug-in to add options that point ChromeDriver to the Opera browser instead. I'll need to figure out what the Capabilities JSON looks like to support this configuration.

@sbabcoc sbabcoc changed the title Update the Opera plug-in to automate Opera via ChromeDriver In Selenium 4, update the Opera plug-in to automate Opera via ChromeDriver Dec 6, 2024
@sbabcoc
Copy link
Owner Author

sbabcoc commented Dec 10, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant