Getting javascript variable value with HTML Agility pack
Is it possible to get a javascript variable value with html agility pack?
<script type="text/javascript">
var title = "Site title";
var articlesummary = "article summary.";
</script>
Is there any way that html agilit开发者_Python百科y pack would allow me to get the value of the variable title
for example?
You can't get the value of a javascript variable in HTML Agility Pack. You have to use regex.
Actually you can do it. HtmlAgilityPack gives you the inner html and you pick your texts&variables by your own way.
For example:
htmlDocument.SelectNodes("//script[@language='javascript']");
This code will give you the inner text of script tag. After that, you may split the whole text ending with ";".
精彩评论