0

I trying to parse html-page with html agility pack, and I want to get some value from element, but this value setted in knockout model.

//...
function jsCycle(cycleid /* another variables */) {
        this.CycleYearID = ko.observable(cycleid);
        /* another variables */
    };

var c1 = new jsCycle('1edb0cc2-82af-e211-896a-3c4a92dbdc51'/* another variables */); 

ko.applyBindings(c1, $('#BoundCycleAreaOne')[0]);
jsModel.cycles.push(c1);
//...

I can get '#BoundCycleAreaOne' element:

var period = document.QuerySelectorAll("#BoundCycleAreaOne");

but also I need his CycleYearID. How I can get it?

jabaldonedo
  • 25,822
  • 8
  • 77
  • 77
viktor.kudria
  • 229
  • 2
  • 14

1 Answers1

2

This is impossible using HtmlAgilityPack and the .html file alone.

While HtmlAgilityPack can parse HTML, it can not run JS code at all.

You can use a tool like Selenium to wait for a given amount of time until KnockoutJS populated the page and then grab the source and feed it to HtmlAgilityPack.

Community
  • 1
  • 1
Benjamin Gruenbaum
  • 270,886
  • 87
  • 504
  • 504