Web????????????
?????С??? ???????[ 2017/7/3 10:14:39 ] ????????????????? WEB????
?????????????к??Web UI?????????????????WatiN?? Selinimu??WebDriver??????VS2010?е?Coded UI???. ??Щ???????????Web?е????????????????????????????Web???????????????Щ?????????????????????????IE COM????HTML DOM ??IE????????WEB?????????????
?????????????????Щ???????????? ??????.NET????shdocvm.dll????????IE??????????mshtml.dll????????IE?е? HTML????
???????
?????????????IE COM?????Web??????????????????????????????????????????????????? ????????????Ч??? ????????????WatiN??Щ???????????????????.
???????????
????shdocvm.dll??mshtml.dll?????????COM?????????????dll?????????????????????
????shdocvm.dll ??COM ????????"Microsoft Internet Controls". ???????????Add References->Com Tab-> Microsoft Internet Controls
????mshtml.dll??COM????????"Microsoft.mshtml"?? ???????????Add References-> .NET Tab->Microsoft.mshtml
????????????ú??????????????????
????using mshtml;
????using SHDocVw;
????????IE
???????shdocvm.dll?е?InternetExplorer??????????????? ????Height??Width?????????????IE?????????Щ?????????????????????????С??????????
????
????static void Main(string[] args)
????{
????InternetExplorer IE = new InternetExplorer();
????IE.Visible = true;
????object nil = new object();
????string CnblogUrl = "http://www.cnblogs.com";
????// ??IE?????????????
????IE.Navigate(CnblogUrl?? ref nil?? ref nil?? ref nil?? ref nil);
????Thread.Sleep(3000);
????// ????IE??????λ??
????IE.Top = 10;
????IE.Left = 10;
????// ????IE???????
????IE.Height = 800;
????IE.Width = 1000;
????// ????????????
????Thread.Sleep(3000);
????string BaiduUrl = "http://www.baidu.com";
????IE.Navigate(BaiduUrl?? ref nil?? ref nil?? ref nil?? ref nil);
????// ?????????
????Thread.Sleep(3000);
????IE.GoBack();
????// ???IE
????Thread.Sleep(3000);
????IE.Refresh();
????// ???IE
????Thread.Sleep(3000);
????IE.Quit();
????}
????
???????IE develop toolbar ??HTML DOM
??????????????????HTML?е????? ??????????????Щ?????id?? ???IE Develop Toolbar????firebug?????????????id.
??????F12???IE Develop Toolbar?? ??????IE???????е?Tools->Develop Tools
????????п????????????е?????textbox??id??"q"
????????IE?е?HTML???
?????????????????????????????????? ????????????????????? ?????"????????"??
???????????mshtml.dll?????getElementById()????????????????HTML???????á? ?????????????????????????????????
????
????static void Main(string[] args)
????{
????InternetExplorer IE = new InternetExplorer();
????IE.Visible = true;
????object nil = new object();
????string CnblogUrl = "http://www.cnblogs.com";
????// ??IE?????????????
????IE.Navigate(CnblogUrl?? ref nil?? ref nil?? ref nil?? ref nil);
????Thread.Sleep(3000);
????// ???DOM????
????HTMLDocument doc = (HTMLDocument)IE.Document;
????// ???????????????Textbox??id?? "q"
????HTMLInputElement SearchTextBox = (HTMLInputElement)doc.getElementById("q");
????SearchTextBox.value = "С???";
????// ???????????"?????"?????id??"btnBloggerSearch"
????HTMLInputElement SearchButton = (HTMLInputElement)doc.getElementById("btnBloggerSearch");
????SearchButton.click();
????}
???? ????Ч??????:
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11