使用Web驱动程序在文本框中自动化坏词的最佳方法

时间:2014-12-03 11:21:52

标签: c# selenium textbox automation webdriver

我有一个场景,我已经获得了222个不应该在所有文本框中输入的不良单词的列表。

如何使用c#和Webdriver编写测试?

我的意思是我知道我可以遍历单词并逐个输入并验证是否显示错误消息。但这需要很长时间。请帮帮我。

1 个答案:

答案 0 :(得分:-1)

如果您要求查看文本框是否包含错误字词,您可以使用以下内容:

var badWords = new List<String> {"bad", "bad1", "bad2"};
if (Regex.IsMatch("bad is the way to go", String.Format("({0})", String.Join("|", badWords.ToArray()))))
    Console.WriteLine(@"bad word");