繁体   English   中英

WebDriver便携式Firefox c#

[英]WebDriver Portable Firefox c#

我试图加载便携式Firefox

FirefoxProfile profile = new FirefoxProfile();
var binary = new FirefoxBinary(Directory.GetCurrentDirectory()+ @"\FirefoxPortable64\FirefoxPortable.exe");

var driver = new FirefoxDriver(binary, profile);

但我收到错误消息Unable to find a matching set of capabilities在行var driver = new FirefoxDriver(binary, profile); Unable to find a matching set of capabilities var driver = new FirefoxDriver(binary, profile);

你能帮我吗?

并在一行中var driver = new FirefoxDriver(binary, profile); 我有警告:

FirefoxDriver不应使用FirefoxBinary对象构造。 改用FirefoxOptions。 此构造函数将在以后的版本中删除。

我该如何重写代码?

UPD:我重写了代码:

FirefoxProfile profile = new FirefoxProfile();
FirefoxOptions options = new FirefoxOptions();
options.Profile = profile;
options.BrowserExecutableLocation = Directory.GetCurrentDirectory() + @"\FirefoxPortable64\FirefoxPortable.exe";
var driver = new FirefoxDriver( options);

但它不起作用,再次出现错误Unable to find a matching set of capabilities

解决方案;

 options.BrowserExecutableLocation = Directory.GetCurrentDirectory() + @"\FirefoxPortable32\App\Firefox\firefox.exe";

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM