我想获取打开网站上的title的值“正式受理”,并将这个值写入Excel,应该怎么做,请各位大神赐教
这是我写的代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MyAutoM
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//检测是否打开指定网页
mshtml.HTMLDocument doc = getInternetExploer("http://135.64.132.8").Document;
//获取title的值“正式受理”,请各位大神帮我补充一下
}
public static SHDocVw.InternetExplorer getInternetExploer(string url)
{
var shell = new Shell32.Shell();
var windows = (SHDocVw.IShellWindows)shell.Windows();
SHDocVw.InternetExplorer ie;
foreach (object window in windows)
{
ie = window as SHDocVw.InternetExplorer;
if (ie != null &&
string.Equals(System.IO.Path.GetFileName(ie.FullName),
"iexplore.exe", StringComparison.CurrentCultureIgnoreCase))
{
if (ie.LocationURL == url)
{
return ie;
}
}
}
return null;
}
}
}