[英]Remove Content before the Main of a page
我正在 c# 中创建一个自动化测试,以搜索页面以查找主要是 href 的字符串,但我只想搜索主页面而不是页面 header。
//Create a StreamReader to read the response
StreamReader readStream;
if (response.CharacterSet == null)
{
readStream = new StreamReader(response.GetResponseStream());
}
else
{
readStream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(response.CharacterSet));
}
//Read the response (page source)
string data = readStream.ReadToEnd();
这是我目前正在使用的代码,但它也从 header 中提取,我想忽略或删除它
我正在 c# 中创建一个自动化测试,以搜索页面以查找主要是 href 的字符串,但我只想搜索主页面而不是页面 header。
//Create a StreamReader to read the response
StreamReader readStream;
if (response.CharacterSet == null)
{
readStream = new StreamReader(response.GetResponseStream());
}
else
{
readStream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(response.CharacterSet));
}
//Read the response (page source)
string data = readStream.ReadToEnd();
这是我目前正在使用的代码,但它也从 header 中提取,我想忽略或删除它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.