码迷,mamicode.com
首页 > Windows程序 > 详细

C# walls

时间:2016-01-28 21:09:49      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:

在学习C#的阶段中,我们一点一点的往前爬,

此代码需要添加selenium ,和 获取 引用。

using Ivony.Html.Parser;
using Ivony.Html;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace taobao
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public static Thread th;
        private void button1_Click(object sender, EventArgs e)
        {
            th = new Thread(new ThreadStart(JDData));
            th.Start();
        }
        void JDData()
        {
            IWebDriver driver = new FirefoxDriver();


            driver.Navigate().GoToUrl("http://list.jd.com/list.html?cat=9987%2C653%2C655&go=0");
            //driver.FindElement(By.Id("startShopping")).Click();
            //Thread.Sleep(5000);

            //IJavaScriptExecutor jse = (IJavaScriptExecutor)driver;
            //int height = 1000;            
            //jse.ExecuteScript("document.documentElement.scrollTop=" + height);  
            //Thread.Sleep(20000);

            string sc = driver.PageSource;

            //以上步骤是获取网页源码
            //var documentsc = new Jumon
            var documenthtmlThree = new JumonyParser().Parse(sc);
            driver.Quit();
        }
    }
}

 

C# walls

标签:

原文地址:http://www.cnblogs.com/Tinamei/p/5167420.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!