繁体   English   中英

删除页面主之前的内容

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM