How to provide OperaWebDriver on c# use Selenium WebDriver

穿精又带淫゛_ 提交于 2019-12-11 00:28:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!