K
K
Kirill2020-07-06 16:19:56
Parsing
Kirill, 2020-07-06 16:19:56

How to parse generated HTML block on HtmlAgilityPack?

Good afternoon.
You need to extract the already generated HTML code from this tag:

<div class="product-price" id="product-price" data-bind='component: { name: "product-price", params: {state: state, showGermanVatMessage: false, isDisplayPrice: true } }'></div>

Before that I did this:
var titleProduct = htmlDocumentProduct.DocumentNode.SelectNodes("//div[@class='product-hero']/h1");
    foreach (var title in titleProduct)
    {
        Console.WriteLine($"Название товара: {title.InnerText}");
    }

But in this case it will not work, because. The item you need doesn't exist yet.
How can I force it to load the finished HTML code, and then parse it?
I suspect that this is somehow related to JSON (although it may not be).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fan92rus, 2020-07-06
@BPL

You can load the page through CEF selenium etc. then there will be a rendered element,
Or take an attribute - parse into json and take the necessary data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question