您的位置:首页 > 编程语言 > C#

C# walls

2016-01-28 20:32 309 查看
在学习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();
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: