我该如何在.NET框架中控制Opera Driver(甚至是浏览器本身)以及Windows系统?https://github.com/operasoftware/operadriver/。我的目标是创建类似于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());