mercredi 22 mai 2019

How to get data (like values in table) from website after it runs JavaScript (when that table loads with js) in c#?

I need to get a value from table, which is visible after JavaScript. My program needs to login to this website (SOLVED) and then it needs to get data from table

https://imgur.com/a/uCYXK18 "data from table" (Need to get yellow highlighted)

I tried HtmlAgilityPack, where I found that these data are loaded with JavaScript

https://imgur.com/a/fpxntZG "HtmlAgilityPack"

Code:

    var loginAddress = "http://myweb/users/login/";
    var loginData = new NameValueCollection
    {
        { "username", "admin" },
        { "password", "*****" }
    };
    var client = new CookieAwareWebClient();
    client.Login(loginAddress, loginData);
    string htmlSource = client.DownloadString("http://myweb/");
    HtmlDocument doc = new HtmlDocument();
    doc.LoadHtml(htmlSource);




Aucun commentaire:

Enregistrer un commentaire