Ger*_*ald 7 c# asp.net internet-explorer screenshot selenium-webdriver
我在ASP.NET网站中使用Selenium 2(Webdriver)来构建服务,用户可以在其中输入他们的URL并获取使用不同浏览器制作的页面截图.
我的页面是Windows Server 2008 R2上的hostet.
截图与FirefoxDriver完美的作品.但是当我使用时InternetExplorerDriver,我只得到一个空的黑色文件.
该应用程序以管理员身份运行 - 因此不存在权限问题.
我的代码:
// Opening the Browser
var ieCapabilities = DesiredCapabilities.InternetExplorer();
ieCapabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);
var browserIe = new InternetExplorerDriver(ieCapabilities);
browserIe.Navigate().GoToUrl("http://www.google.com");
// Screenshot
var dir = Server.MapPath("/screenshots/");
browserIe.GetScreenshot().SaveAsFile(dir + "Filename.png", ImageFormat.Png);
browserIe.Close();
Run Code Online (Sandbox Code Playgroud)
为什么我的文件是黑色的任何想法?谢谢!
| 归档时间: |
|
| 查看次数: |
5616 次 |
| 最近记录: |