c# - 尝试从“Systems.Windows.Forms”中使用,以便我可以在我的 C# 测试应用程序中从剪贴板中读取
问题描述
在Visual Studio 2019社区版中为 C# 测试程序设置有点困难的时间Windows.System.Forms
是为了访问该类而使用的参考,Clipboard
以便我可以从 Windows 10 桌面剪贴板设置和获取文本信息。
当我去添加参考时,我找不到Windows.System.Forms
,而是看到Windows_System_Forms
。我试图将其作为参考,我得到:
警告 MSB3290 无法为类型库“{215d64d2-031c-33c7-96e3-61794cd1ee61}”创建包装程序集。类型库“System_Windows_Forms”是从 CLR 程序集导出的,不能作为 CLR 程序集重新导入。
我怎样才能包含System.Windows.Forms
,以便下面的代码可以工作?
[Then(@"validation text is ""(.*)""")]
public void ThenTestIs(string res)
{
// Setup waiting for test selectors to render
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, 5));
string xpath = (string)Properties.MflixXpaths.Default["mflix_result"];
xpath = xpath.Replace("TEST", testName);
driver.FindElement(By.XPath(xpath)).Click();
string val = Clipboard.GetText();
Assert.AreEqual(val, res);
}
解决方案
推荐阅读
- javascript - setInterval 计时器结果未在 innerHTML 上更新
- python - 使用 Python 移动和重命名文件
- javascript - 不使用 index.html 时的自定义电子标题栏
- mysql - SQL Fiddle MySQL 5.6 vs MS SQL Server 2017 - 简单的创建和插入
- ios - 重新加载数据时的 UICollectionView 奇怪的动画(幽灵单元、flash)
- ruby-on-rails - 如何在将参数发送到数据库之前对其进行修改
- genexus - 我如何在genexus中发出http get请求?
- django - 当我尝试通过 https 登录到 Django 管理员时,python 服务器已关闭且没有任何错误
- apache-spark - 将 conf 文件添加到 Google Dataproc 中的类路径
- python - Python 多处理 - 了解每个进程的进度的最佳方法