文件名称:.net操作IE窗口
文件大小:2KB
文件格式:TXT
更新时间:2012-10-04 13:10:26
操作IE窗口
操作IE窗口 SHDocVw.InternetExplorer ies = new SHDocVw.InternetExplorer(); //DataSet1TableAdapters.userTableAdapter ud = new userTableAdapter(); SHDocVw.WebBrowser wb = new SHDocVw.WebBrowser(); SHDocVw.IShellWindows swc = new SHDocVw.ShellWindowsClass(); mshtml.HTMLInputElementClass input; foreach (var item in swc) { SHDocVw.InternetExplorer objIE = (SHDocVw.InternetExplorer)item; System.Console.Write(objIE.FullName); System.Console.Write(objIE.LocationName); //System.Console.Write(objIE.Document); System.Console.Write(objIE.Name); if (objIE.LocationName == "国航飞行安全管理信息系统") { // System.Console.Write("----"); mshtml.IHTMLDocument2 ieDoc = (mshtml.IHTMLDocument2)objIE.Document; foreach (mshtml.IHTMLElement ieElement in ieDoc.all) { //if its tag is input and name is q(question) if (ieElement.tagName.ToUpper().Equals("INPUT")) { input = ((mshtml.HTMLInputElementClass)ieElement); if (input.name == "username") { //Response.Write(input.value); input.value = ""+name+""; } if (input.name == "password") { // Response.Write(input.value); input.value = "GHGF20096152"; } } } }