简体   繁体   中英

how to run javascript code in C# crawler on server side

I have developed crawler in C# .

I am reading data from one page that is list page, It uses javascript for redirecting to next page.

function is - <a onclick="redirectToNextPage(PageID)">More</a>

How i can run this function in serverside and get url of the next page, so that by that url i can save that page.

I want to run javascript function in C# to get url of next page

You'll almost certainly need a headless browser to do that, not just running JavaScript code without the context it expects to run in. This question and its answer list some headless browsers that can be used from C# (not all of them have JavaScript support, though). That list may well be out of date now, but that's the term you need to search for.

Try https://javascriptdotnet.codeplex.com/ .

It exposes Google V8 JS engine to CLI and also allows to CLI objects to be manipulated by JS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM