c# get content loaded by js from url

一曲冷凌霜 提交于 2021-02-10 18:07:49

问题


I wanna get table from this url but content loads by javascript. I download HTML string like this

WebClient wc = new WebClient();
var html = wc.DownloadString("https://www.bloomberg.com/markets/currencies");

how can i get javascript loaded content??


回答1:


WebClient and DownloadString will just download the content of the page as string, to be able to run the JavaScript code on this page, you will need an object which understand DOM and can run JavaScript, this will be a browser.

Some more information about this subject:
Running Scripts in HtmlAgilityPack
Load a DOM and Execute javascript, server side, with .Net



来源:https://stackoverflow.com/questions/51154007/c-sharp-get-content-loaded-by-js-from-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!