class Program
    {
        static void Main(string[] args)
        {
            SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
            string filename;
            foreach (SHDocVw.InternetExplorer ie in shellWindows)
            {
                filename = "iexplore";// Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
                if (filename.Equals("iexplore"))
                {
                    Console.WriteLine("Web Site   : {0}", ie.LocationURL);
                    mshtml.IHTMLDocument2 htmlDoc = ie.Document as mshtml.IHTMLDocument2;
                    Console.WriteLine("   Document Snippet: {0}", ((htmlDoc != null) ? htmlDoc.body.outerHTML.Substring(0, 40) : "***Failed***"));
                    if (ie.LocationURL == "http://s.taobao.com/search?q=%D2%C2%B7%FE&initiative_id=tbindexz_20130105&commend=all&source=suggest&ssid=s5-e-p1&suggest=0_3&newpre=null&bcoffset=1&s=40#J_FilterTabBar")
                    {
                        SearchTextInGoogle(htmlDoc, "衣服");
                    }
                    Console.WriteLine("{0}{0}", Environment.NewLine);
                }
            }
            Console.WriteLine("完成");
            Console.ReadLine();
        }
        public static void SearchTextInGoogle(mshtml.IHTMLDocument2 ieDoc, string searchText)
        {
            mshtml.HTMLInputElement input;
           
            //set the text to be searched   
            //foreach (mshtml.IHTMLElement ieElement in ieDoc.all)
            //{
            //    //if its tag is input and name is q(question)   
            //    if (ieElement.tagName.ToUpper() == "INPUT")
            //    {
            //        input = ((mshtml.HTMLInputElement)ieElement);
            //        if (input.name == "wd")
            //        {
            //            input.value = searchText;
            //            //break;
            //        }
            //    }
            //}

//click the submit button to search   
            foreach (mshtml.IHTMLElement ieElement in ieDoc.all)
            {
                //if its tag is input   
                if (ieElement.tagName.ToUpper() == "A")
                {
                   
                    if (ieElement.className == "page-next")
                    {
                        ieElement.click();
                       
                    }
                }
              
            }
        }
    }

最新文章

  1. HashMap的内部实现机制,Hash是怎样实现的,什么时候ReHash
  2. linux apt-get install 错误: Package has no installation candidate
  3. 王爽 <<汇编 语言>> 13.6 BIOS中断例程应用
  4. C4.5算法
  5. Java基础(30):String对象的常用方法与实例(String类)
  6. 总结Selenium自动化测试方法(六)常见的异常错误处理
  7. BZOJ_1002_[FJOI2007]_轮状病毒_(递推+高精)
  8. Android WebView JavaScript交互
  9. 解决WCF 调用方未由服务器进行身份验证或消息包含无效或过期的安全上下文令牌
  10. 使用批处理根据项目工程文件生成Nuget包并发布(支持.NET Core)
  11. EF6与Mysql疑难问题记录
  12. rsync的详细配置
  13. Azure Sphere–“Object reference not set to an instance of an object” 解决办法
  14. Typescript中抽象类与接口详细对比与应用场景介绍
  15. JavaBean-EL-JSTL-MVC
  16. hbase 1.2.1 分布式安装
  17. 了解一下UTF-16
  18. right spindle supply short to gnd-- compact version
  19. TOJ3448: 小学生的作业
  20. apt-get install 和 pip install的区别

热门文章

  1. hdu 2149 (巴什博奕)
  2. 网络分层和Http协议原理
  3. COGS 2392 2393 2395 有标号的二分图计数
  4. tyvj/joyoi 1374 火车进出栈问题(水水版)
  5. 当我new class的时候,提示以下错误: Unable to parse template "Class" Error message: This template did not produce a Java class or an interface Error parsing file template: Unable to find resource 'Package Header.j
  6. 第一个java程序的编译
  7. node(基础)_node中的javascript
  8. vue的一些小坑
  9. CentOS7 下 Hadoop 单节点(伪分布式)部署
  10. Android中不显示标题