使用webbrowser在InnerHtml文件中搜索某些字符串

时间:2016-02-08 10:04:43

标签: c# html

我是c#的初学者,我似乎无法从网站上删除内部HTML。该网站是一个票务管理系统,其中包含按ID输入的票据。输入ID后,我希望在Windows表单应用程序文本框中显示一些信息:票证标题,创建时间等等。

直到现在,我使用webbrowser登录网站,然后我想在一个文本框中输入一个票证ID,按下Generate按钮后我想在一个文本框中显示票证标题。

这是我的代码: //用于登录按钮

this.webBrowser1.Navigate("https://elvis.harman.com/");

            while (this.webBrowser1.ReadyState != WebBrowserReadyState.Complete)
            {
                Thread.Sleep(100);
                Application.DoEvents();
            }

            //textBox1.Text= this.webBrowser1.Document.Window.Frames[2].Document.GetElementsByTagName("input").Count.ToString();


            this.webBrowser1.Document.Window.Frames[2].Document.GetElementsByTagName("input")[0].InnerText = textBox1.Text;
            this.webBrowser1.Document.Window.Frames[2].Document.GetElementsByTagName("input")[1].InnerText = textBox2.Text;
            this.webBrowser1.Document.Window.Frames[2].Document.GetElementsByTagName("button")[0].InvokeMember("click");

//用于生成按钮

    this.webBrowser1.Navigate("https://elvis.harman.com/cgi-bin/ticket?TID=" + txtID.Text);
this.webBrowser1.Update();
this.webBrowser1.Refresh();
var codes = this.webBrowser1.Document.GetElementById("field_100").InnerHtml.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(m => m.Trim()).ToList(); 
// with this i tried to separate the innerHtml by lines

//and now i try to start scrapping beggining with a following line:
 var ticketLines = codes.Where(m => m.StartsWith("<TD style=\"WIDTH: 65px; HEIGHT: 22px; LEFT: 110px\" class=hb-table-cell>"));
List<string> ticketTitles = new List<string>();

            foreach (string line in ticketLines)
            {   
                //select the line from which you want to start scrapping
                int y = codes.IndexOf(line);
                //ticket title
                ticketTitles.Add(codes[y + 1].Substring(codes[y + 1].IndexOf(">") + 1, codes[y + 1].Length - codes[y + 1].IndexOf(">") - 6));
}

我的问题:当我在序列上添加手表时

var codes = this.webBrowser1.Document.GetElementById("field_100").InnerHtml.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(m => m.Trim()).ToList();

我想看看这样的innerHtml文本:

<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1806338</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[DI]Unnecessary refinement when an exact address was entered</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2016-02-02</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2016-01-20</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>uchendu chibueze</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>111153.3.210</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>BMW_Abgleich</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-06</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>C(3)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>2-Very High</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1806339</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[RPL]unplausible route guidance - using an exit and go back on the previous street</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2016-02-02</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2016-01-20</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>dumke marcus md</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>111153.3.210</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>BMW_Abgleich</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-06</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>B(2)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>1-Urgent</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1809964</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[GUIDO]Mismatch of exit signpost.</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2016-02-06</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2016-02-02</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>fritz michael</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>NBTevo_H16043A</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-08</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>C(3)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>&nbsp;</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1809503</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[DB][RPL][COMP] Split screen stuck in E-branch</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2016-02-05</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2016-02-05</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>SUngureanu</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>111153.3.213</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>MLangfeldt</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>SW_SubmitPool</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-05</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>C(3)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>&nbsp;</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1795960</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[POI]Missing second half of postal code [XMAS15](BI8)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2016-01-18</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2015-12-28</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>uchendu chibueze</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>111153.3.210</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>BMW_Abgleich</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-06</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>C(3)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>2-Very High</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1795961</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[DB] [RPL][ID5] unplausible route guidance guiding suggest to use side street in FWY intersection</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2016-01-18</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2016-01-04</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>dumke marcus md</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>111153.3.210</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>BMW_Abgleich</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-06</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>B(2)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>1-Urgent</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1790333</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[DB] RT icon is missing for Route 3 [XMAS15]</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2016-01-09</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2015-12-29</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>fritz michael</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>111153.3.210</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-08</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>C(3)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>&nbsp;</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1783168</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[GUIDA] System announced Connecticut 111, but roadbook listed Main Street.-[USDTSV_1534]</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2015-12-18</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2015-10-24</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>fritz michael</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>111151.1.230</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-08</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>C(3)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>2-Very High</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1790337</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[GUIDO]realistic road sign missing text [XMAS15]</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2016-01-09</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2016-01-05</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>uchendu chibueze</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>111153.3.210</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>BMW_Abgleich</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-06</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>C(3)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>&nbsp;</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1772458</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>Content for Exit 73 realistic road sign is not grayed out [req_ID5]</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2015-12-03</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2015-11-24</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>foerster felix f</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>111153.1.220</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>BMW_Abgleich</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>IModoleev</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-06</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>C(3)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>&nbsp;</TD></TR>
<TR style="LINE-HEIGHT: 22px; WIDTH: 100%" class=hb-ui-grid-row>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 0px" class=hb-table-cell>
<DIV class=hb-ui-calendar></DIV></TD>
<TD style="WIDTH: 25px; HEIGHT: 22px; LEFT: 25px" class=hb-table-cell>
<DIV class=hb-ui-attachment></DIV></TD>
<TD style="WIDTH: 60px; HEIGHT: 22px; LEFT: 50px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 65px; HEIGHT: 22px; LEFT: 110px" class=hb-table-cell>1808873</TD>
<TD style="WIDTH: 542px; HEIGHT: 22px; LEFT: 175px" class=hb-table-cell>[MAP] Navi announced to bear left, at the same time it shows me to exit right</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 717px" class=hb-table-cell>2016-02-04</TD>
<TD style="WIDTH: 84px; HEIGHT: 22px; LEFT: 812px" class=hb-table-cell>2016-02-02</TD>
<TD style="WIDTH: 132px; HEIGHT: 22px; LEFT: 896px" class=hb-table-cell>bonk markus</TD>
<TD style="WIDTH: 118px; HEIGHT: 22px; LEFT: 1028px" class=hb-table-cell>NBTevo_G15521B</TD>
<TD style="WIDTH: 126px; HEIGHT: 22px; LEFT: 1146px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 16px; HEIGHT: 22px; LEFT: 1272px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 31px; HEIGHT: 22px; LEFT: 1288px" class=hb-table-cell>&nbsp;</TD>
<TD style="WIDTH: 162px; HEIGHT: 22px; LEFT: 1319px" class=hb-table-cell>BMW_Abgleich</TD>
<TD style="WIDTH: 73px; HEIGHT: 22px; LEFT: 1481px" class=hb-table-cell>Entered</TD>
<TD style="WIDTH: 102px; HEIGHT: 22px; LEFT: 1554px" class=hb-table-cell>SW_SubmitPool</TD>
<TD style="WIDTH: 99px; HEIGHT: 22px; LEFT: 1656px" class=hb-table-cell>Categorizing</TD>
<TD style="WIDTH: 86px; HEIGHT: 22px; LEFT: 1755px" class=hb-table-cell>2016-02-06</TD>
<TD style="WIDTH: 64px; HEIGHT: 22px; LEFT: 1841px" class=hb-table-cell>C(3)</TD>
<TD style="WIDTH: 95px; HEIGHT: 22px; LEFT: 1905px" class=hb-table-cell>3-High</TD></TR></TBODY></TABLE></DIV>
<DIV style="WIDTH: 18px; HEIGHT: 236px; TOP: 0px; LEFT: 1072px" class=hb-grid-scroll-vertical unselectable="on" closure_uid_seyus8="64">
<DIV style="WIDTH: 1px; HEIGHT: 58765px; TOP: 0px; LEFT: 0px" unselectable="on"></DIV></DIV>
<DIV style="WIDTH: 1052px; HEIGHT: 18px; TOP: 236px; LEFT: 20px" class=hb-grid-scroll-horizontal unselectable="on" closure_uid_seyus8="65">
<DIV style="WIDTH: 2095px; HEIGHT: 1px; TOP: 0px; LEFT: 0px" unselectable="on"></DIV></DIV></DIV>
<DIV hideFocus class="goog-toolbar goog-toolbar-horizontal" role=toolbar yH="toolbar" unselectable="on" closure_uid_seyus8="97">
<DIV id=:2d class="hb-toolbar-label goog-inline-block" tabIndex=0 unselectable="on" closure_uid_seyus8="73">Mode:</DIV>
<DIV aria-haspopup=true id=:2i class="goog-inline-block goog-toolbar-menu-button" title="" role=button tabIndex=0 yH="button" unselectable="on" closure_uid_seyus8="75">
<DIV class="goog-inline-block goog-toolbar-menu-button-outer-box" unselectable="on">
<DIV class="goog-inline-block goog-toolbar-menu-button-inner-box" unselectable="on">
<DIV class="goog-inline-block goog-toolbar-menu-button-caption" unselectable="on">All</DIV>
<DIV class="goog-inline-block goog-toolbar-menu-button-dropdown" unselectable="on">&nbsp;</DIV></DIV></DIV></DIV>
<DIV style="DISPLAY: none" id=:2j class="goog-toolbar-separator goog-inline-block" role=separator yH="separator" unselectable="on">&nbsp;</DIV>
<DIV style="DISPLAY: none" id=:2k class="goog-inline-block goog-toolbar-button" title="First page" role=button yH="button" unselectable="on" closure_uid_seyus8="78">
<DIV class="goog-inline-block goog-toolbar-button-outer-box" unselectable="on">
<DIV class="goog-inline-block goog-toolbar-button-inner-box" unselectable="on">
<DIV class="icon hb-grid-first" unselectable="on"></DIV></DIV></DIV></DIV>
<DIV style="DISPLAY: none" id=:2l class="goog-inline-block goog-toolbar-button" title="Previous page" role=button yH="button" unselectable="on" closure_uid_seyus8="80">
<DIV class="goog-inline-block goog-toolbar-button-outer-box" unselectable="on">
<DIV class="goog-inline-block goog-toolbar-button-inner-box" unselectable="on">
<DIV class="icon hb-grid-left" unselectable="on"></DIV></DIV></DIV></DIV>
<DIV style="DISPLAY: none" id=:2m class="hb-toolbar-label goog-inline-block" unselectable="on" closure_uid_seyus8="82">Page</DIV><INPUT style="DISPLAY: none" id=:2n class="hb-toolbar-editor goog-inline-block" value=1 maxLength=4 size=2 type=text closure_uid_seyus8="84">
<DIV style="DISPLAY: none" id=:2o class="hb-toolbar-label goog-inline-block" unselectable="on" closure_uid_seyus8="86">of 16</DIV>
<DIV style="DISPLAY: none" id=:2p class="goog-inline-block goog-toolbar-button" title="Next page" role=button yH="button" unselectable="on" closure_uid_seyus8="88">
<DIV class="goog-inline-block goog-toolbar-button-outer-box" unselectable="on">
<DIV class="goog-inline-block goog-toolbar-button-inner-box" unselectable="on">
<DIV class="icon hb-grid-right" unselectable="on"></DIV></DIV></DIV></DIV>
<DIV style="DISPLAY: none" id=:2q class="goog-inline-block goog-toolbar-button" title="Last page" role=button yH="button" unselectable="on" closure_uid_seyus8="90">
<DIV class="goog-inline-block goog-toolbar-button-outer-box" unselectable="on">
<DIV class="goog-inline-block goog-toolbar-button-inner-box" unselectable="on">
<DIV class="icon hb-grid-last" unselectable="on"></DIV></DIV></DIV></DIV>
<DIV id=:2r class="goog-toolbar-separator goog-inline-block" role=separator yH="separator" unselectable="on">&nbsp;</DIV>
<DIV id=:2s class="goog-inline-block goog-toolbar-button" title=Refresh role=button tabIndex=0 yH="button" unselectable="on" closure_uid_seyus8="92">
<DIV class="goog-inline-block goog-toolbar-button-outer-box" unselectable="on">
<DIV class="goog-inline-block goog-toolbar-button-inner-box" unselectable="on">
<DIV class="icon icon hb-grid-refresh" unselectable="on"></DIV></DIV></DIV></DIV>
<DIV id=:2t class="goog-toolbar-separator goog-inline-block" role=separator yH="separator" unselectable="on">&nbsp;</DIV>
<DIV style="COLOR: black" id=:2u class="hb-toolbar-label goog-inline-block" tabIndex=0 unselectable="on" closure_uid_seyus8="94">2554 tickets found</DIV></DIV

我的问题:

  • 将ticketID输入我的文本框并按下button_2(&#34; Generate&#34;)后,页面不会刷新,而是显示票证的主列表,而不是指定的票证条目。
  • 我试图通过票证ID废弃这个innerhtml文件,正如您在内部html文件中看到的那样。例如,我正在尝试查看故障单1806338,并在innerHtml文件的下一行中提取标题,创建于,发布的信息。

有人可以给我一些提示吗? 我尝试使用HtmlAgilityPack和Selenium进行报废,但只有使用webbrowser,我才设法直到这一点。 谢谢!

1 个答案:

答案 0 :(得分:0)

我设法解决了这个问题,我将在此发布,以便这篇文章有理由:)

foreach (string line in ticketLines)
            {   
                if (line.Contains(searchkeys)) 
                {
                    //daca se gaseste ce e in txtID se ia indexul liniei si il bag in txtTitle.text
                    int y = codes.IndexOf(line);
                    txtTitle.Text = codes[y+1].Substring(codes[y + 1].IndexOf(">") + 1, codes[y + 1].Length - codes[y + 1].IndexOf(">") - 6);
                    txtCreatedAt.Text = codes[y + 3].Substring(codes[y + 3].IndexOf(">") + 1, codes[y + 3].Length - codes[y + 3].IndexOf(">") - 6);
                    txtCreatedBy.Text = codes[y + 4].Substring(codes[y + 4].IndexOf(">") + 1, codes[y + 4].Length - codes[y + 4].IndexOf(">") - 6);

                    break;
                }


            }