There is a page on which JS is partially processed. An application in C #, I make a request through HttpClient (I tried it through WebClient) - but, of course, I don’t get the desired result. How to make JS process this page first and then only load it?
1 answer
Use a standard browser component, I suppose? ps as already written - yes, there are not enough details. You can use the class ( https://msdn.microsoft.com/en-ru/library/system.windows.forms.webbrowser(v=vs.110).aspx ) code like this:
private void browserProgress(e WebBrowserProgressChangedEventArgs) { if (e.CurrentProgress == e.MaximumProgress) { waitForReady(); } } browser = new WebBrowser() browser.Navigate(URL) browser.OnProgressChanged += browserProgress
True, the question arises - how to implement waitForReady? I did not find any events related to working with DOM. As an option, when a waitForReady is reached, take a timer, check on the timer readiness and when ready to stop. But this is some very crooked method.
- Well, at first I just pointed out that we should look in the direction of the browser - I added the details later. - Alexander Pozharskii
- @PashaPash see the content history of the response. In our opinion, he was more like a question than an answer. The current answer is much better. - Alex
- Can I here (as an extreme case) simulate a delay of several seconds? - oleg.vorobiov
- IMHO, if you already use delays, then create and start a standard timer ( msdn.microsoft.com/ru-ru/library/… ) at a short interval, timer to check the readiness of the necessary data and, if ready, to process them and destroy the timer. - Alexander Pozharskii
- @Alex ok, I agree, the first revision looked strange :) - PashaPash ♦
|