c# - 如何在清单中选择多个值?
问题描述
我想从测试数据中选择清单模式上的多个值。CS。我收到以下错误我做错了什么?
Error CS1950 The best overloaded Add method 'List<string>.Add(string)' for the collection initializer has some invalid arguments.
Severity Code Description Project File Line Suppression State
Error CS1503 Argument 1: cannot convert from 'string[]' to 'string'
这些是我的代码
Creating a generic method to select multiple values in the checklist
public ChecklistModal SelectMultipleItemsInChecklist(List<string> value)
{
foreach (var v in value)
{
IWebElement item = Driver.Instance.FindElement(By.XPath("//input[@tmpname='" + v + "']"));
item.Click();
}
return this;
}
调用方法
public Page SelectMultipleDispatch(List<string> multiFactors)
{
.SelectMultipleItemsInChecklist(multiFactors)
.ClickSave()
return this;
}
测试数据。CS
public static string[] dispatchFactors = { "Caller (Uncooperative)", "Communication Specialist"}
去测试
TestPage.Page.SelectMultipleDispatch(new List<string> { Data.dispatchFactors });
解决方案
推荐阅读
- angular - 基于表单无效的Angular 8按钮禁用
- ldap - Weblogic LDAP 连接超时与 CPU 峰值
- c++ - 如何结束 AsyncWebServer ESP32
- h.264 - 强制 x264 编码相对于第一个 (IDR) 帧的所有帧
- google-app-engine - 如何使用内部 ip 配置标准 env app-engine 和 cloudsql 实例之间的通信
- node.js - 在节点 js 模块中使用加密的 IV LENGTH 无效
- sql-server - 获取特定用户 SQL 服务器的最大余额
- angular - 如何访问 DOM 内 mat-tree 中嵌套节点的级别属性?
- json - 使用 API 中的 Json 数据制作下拉菜单列表
- java - Docker 在类路径上找不到资源