What is now: locally saved html page with js, changing in which some parameters we get different content.

What you need: load the code of this page into a variable, open it, save the resulting code (the result of js). Ideally, IdHTTP (Indy) would fit, but I can’t understand if you can upload HTML code instead of a URL into it. Tell me, how can this be done (without using browser elements)?

  • IdHTTP - will not perform javascript. "without the use of browser elements" - why such a restriction? - Igor
  • If you already have something, put the code in which you have any difficulties. - 0xdb
  • The difficulties are not in the code, but in the choice of the method of implementation, since web-elements for me is a new field of activity. I have an html code at the entrance (not even a file, but I will create it directly when the program is executed), in which I will get different results by changing parameters in js ... At the output, I need the html code of the resulting page (for further parsing) , the page itself (visually) is of no interest and should not be displayed anywhere. Yandex.Maps scripts. - Anton
  • Что есть сейчас: локально сохранённая html страница с js, меняя в которой некоторые параметры получаем разное содержимое - are you sure that this will work? checked? - Zam

1 answer 1

In addition to browsers, there is nothing more, because the JS engine (for example, V8 in Chromium) and the API (DOM, BOM and others) are engaged in JavaScript. HTML parsing still makes sense to do a separate library, so there are such. With a big stretch - CSS. But JS with all APIs - that’s for sure the browser.

There are browsers that support the work of "offscreen", that is, without rendering (although it is always possible to have a crutch of the type to remove the window off the screen, etc.)

In Delphi, you can use the standard TWebBrowser, but this is a Donkey with all the consequences. Even in Delphi, you can precisely use CEF through the dcef3 shell, it is better, but I also didn’t like it, there are rough edges, it is suitable only for such tasks, namely for the Web UI, I did not use it.
And it is better to work immediately with those technologies that will be useful more than once.

Rulit, perhaps, Awesomium, but it is only for .NET.

So, IMHO, ideally, you would not only master the "new" for you "browser elements", but also switch to a new language.
After all, browsers are far from the only problem that is easily solved on .NET and with difficulty - on Delphi, with a rich past, but a dull present.
Alas.

Although, dolphists are still in demand, but usually on old projects.
For why write a new one on it? As a rule - no need. Alas again.

  • "After all, browsers are far from the only problem that is easily solved on .NET and with difficulty - on Delphi, with a rich past, but a dull present." - there really is something to think about ... TWebBrowser - could not make friends with scripts, not everything is loading (just hiding error messages is not an option) ... Chronium in this regard is no problem ... I was able to get the code in half BUT pages: I look at the code in the debugger of the mozill and from the chronicle: do not match ... Very roughly, if you say, the Chronium "did not reveal" the contents of one necessary block. - Anton
  • @Anton In addition to the tools, a change of approach to the problem still makes sense. I do not know about you, but I used to suffer greatly from the straightness of thinking (it is also "square-nested"). When you choose one approach (most likely, a good one in the past), you suffer with it, you try to do more stupidly, go ahead, and you don’t even think to try anything else. It breaks all deadlines ... What is your task? If the classic task is to create a bot for a site with AJAX, and the data is loaded via AJAX, then the browser engine is not necessary - there is also an HTTP option and sniffer with debuggers. - Rou1997
  • The task is to pick up tiles of maps from Yandex and Google. There is a local html in which all the necessary parameters are written. Having opened it, I get an image, while the resulting code contains links to tiles and their position relative to the specified coordinates. This is the information I need to get (link to the tile, position x, y). Perhaps it is worth looking for other ways to get links to the necessary tiles ... - Anton