问题
How to provide OperaWebDriver on c# use Selenium WebDriver
IWebDriver aDriver = new OperaDriver("path_to_operadriver.exe);
I have exception :
System.InvalidOperationException : unknown error: cannot find Opera binary (Driver info: OperaDriver=0.2.0 )
回答1:
You've got to download opera chromium driver.
Here's a snippet how it should work:
DesiredCapabilities capabilities = DesiredCapabilities.opera();
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/opera");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
回答2:
Using setBinary gives me an error. I am able to resolve it by using this:
options.BinaryLocation = @"/path/to/opera";
Similarly for chrome as well.
来源:https://stackoverflow.com/questions/39391309/how-to-provide-operawebdriver-on-c-sharp-use-selenium-webdriver