将屏幕截图写入测试结果目录的权限问题 [英] Permission issue to write screenshot to test result directory

查看:114
本文介绍了将屏幕截图写入测试结果目录的权限问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编码的UI测试用例中编写截图时遇到问题。

图片截图= UITestControl.Desktop.CaptureImage(); 
string strImageName =" test.png" ;;
screenshots.Save(Path.Combine(testContext.TestResultsDirectory,strImageName));

在上面的代码中,我要做的就是捕获屏幕截图并将其写入测试结果目录。但这总是引发许可问题的例外。如果我将其修改为其他文件夹名称,它可以正常工作。


有人可以帮我吗?我正在使用visual studio 2015.谢谢

解决方案

它与此问题类似:


https://social.msdn.microsoft.com/Forums/en-US/5977472a-b247-4257-a99f-2b4f433d3605/coded-ui-test-save-screenshot-异常-a-generic-error-occurred-in-gdi?forum = vsautotest


该线程中提出的解决方案似乎不起作用


I am having an issue writing screenshot within my coded UI test case.

                        Image screenshots = UITestControl.Desktop.CaptureImage();
                        string strImageName = "test.png";
                        screenshots.Save(Path.Combine(testContext.TestResultsDirectory, strImageName));

In the above code, all I am trying to do is to capture a screenshot and write it to test result directory. But this always throw an exception with permission issue. If I modify it to other folder name, it works fine.

Could someone help me with this? I am using visual studio 2015. Thanks

解决方案

It is similar as this issue:

https://social.msdn.microsoft.com/Forums/en-US/5977472a-b247-4257-a99f-2b4f433d3605/coded-ui-test-save-screenshot-exception-a-generic-error-occurred-in-gdi?forum=vsautotest

The solution proposed in that thread does not seem to work


这篇关于将屏幕截图写入测试结果目录的权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆