我正在使用 Watin,我想在页面源代码 (HTML) 中搜索,例如 ctrl+F 搜索,最好的方法是什么?
感谢您的帮助, 石然
最佳答案
这应该对您有所帮助,这是一个如何实现它的示例
// Find text like ctr+F (NOT IN SOURCE BUT IN "WHAT YOU SEE"
if (ie.Text.Contains("SOME TEXT TO FIND").Equals(true))
{
//Do stuff you would like when found here
MessageBox.Show("Text Found! ");
}
else
{
// cant find
}
//OR
// Find text in SOURCE
if (ie.Html.Contains("SOME TEXT TO FIND").Equals(true))
{
//Do stuff you would like when found here
MessageBox.Show("Text Found! ");
}
else
{
// cant find
}
关于c# - 如何获取页面源并使用Watin进行搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4440200/