【发布时间】:2011-09-11 01:44:03
【问题描述】:
如何在 .NET 框架内控制 Windows 上的 Opera Driver https://github.com/operasoftware/operadriver/(甚至是 Opera 浏览器本身)?
我的目标是制作类似于 Browsershots.org 的东西
【问题讨论】:
如何在 .NET 框架内控制 Windows 上的 Opera Driver https://github.com/operasoftware/operadriver/(甚至是 Opera 浏览器本身)?
我的目标是制作类似于 Browsershots.org 的东西
【问题讨论】:
最简单的方法是使用 RemoteWebDriver,这需要 Selenium 服务器正在运行。代码如下所示(警告: 未经测试的代码)。
// Assumes the Selenium server is running on port 4444 on localhost.
// Note that the Opera() method of the DesiredCapabilities class is
// not included in 2.0rc2 (the currently available binary release),
// but does exist in the trunk.
IWebDriver driver = new RemoteWebDriver("http://localhost:4444/wd/hub", DesiredCapabilities.Opera());
【讨论】: