Windows phone 7 在wp7上使用webclient和htmlAgilityPack获得从javascript生成的html
我想按时完成时间表 首先,, 我曾尝试将webclient与htmlAgilityPack一起使用,并访问表id=“table theater”,但显然是从java脚本生成的html,因此innetHTML中的表是空的Windows phone 7 在wp7上使用webclient和htmlAgilityPack获得从javascript生成的html,windows-phone-7,webclient,windows-phone-7.1,html-agility-pack,Windows Phone 7,Webclient,Windows Phone 7.1,Html Agility Pack,我想按时完成时间表 首先,, 我曾尝试将webclient与htmlAgilityPack一起使用,并访问表id=“table theater”,但显然是从java脚本生成的html,因此innetHTML中的表是空的 public void LoadMovieShowTime(string MovieLink) { WebClient MovieShowTimeclient = new WebClient(); MovieShowTim
public void LoadMovieShowTime(string MovieLink)
{
WebClient MovieShowTimeclient = new WebClient();
MovieShowTimeclient.DownloadStringAsync(new Uri(MovieLink));
MovieShowTimeclient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(MovieShowTimeclient_DownloadStringCompleted);
}
void MovieShowTimeclient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(e.Result);
var node = doc.DocumentNode.Descendants("div").First()
.Elements("div").Skip(1).First()
.Elements("div").Skip(1).First()
.Element("div")
.Elements("table").FirstOrDefault(table => table.Attributes["class"].Value == "table-theater");
}
是否可以在windows phone上使用webclient获取数据?或者有没有其他可行的方法来获得它
第二,,
我已经试着从移动网站上获取时间表,这是
但是返回要求我启用cookies。我是新手,我发现有一种方法可以通过覆盖webRequest cookies来扩展webcline的功能,但是找不到任何关于如何使用它的参考
感谢您的回复和帮助:)仅仅因为表格是用JavaScript生成的,并不意味着WebBrowser控件不会呈现它。确保设置为true,这将确保执行呈现表的JavaScript。然后可以“刮取”结果。webclient的行为与webcontrol不同,它不呈现JavaScript。是否可以从webBrowser控件获取html?你能解释一下吗?谢谢,您可以从web浏览器控件以字符串形式获取html。我会使用隐藏的web浏览器来获取和呈现页面。这正是我现在所做的。但是我还没有找到它(谢谢你!)还有一个问题,为什么地址返回到基址“”,而不是注入的地址?在webClient上,地址不会返回到基地址。非常感谢。