0

I am new to coding. I am trying to make a simple console app that will run internet speed test. I've searched all over and I couldn't find the answer. I tried all the sample answers but I couldn't get the program to run. For now, my program returns 0 which is a value from HTML source document. I need the value from javascript. the website is https://fast.com/en/ I only need the speed test results. I need help. here is my code:

enter code here
class Program
{
    [STAThread]
    static void Main(string[] args) 
    {
        HtmlWeb web = new HtmlWeb();
        string url = "https://fast.com/en/";
        HtmlDocument doc = web.LoadFromBrowser(url, html =>
          {
              return !html.Contains
              ("<div class=\"speed-results-container succeeded\"  
              id=\"speed_value\" ></div>");
          });

         var t1 = doc.DocumentNode.SelectSingleNode
             ("//div[@id='speed-value']").InnerText;
         Console.WriteLine($"{t1}");

    }
}
2
  • 3
    Possible duplicate of Running Scripts in HtmlAgilityPack Commented Apr 6, 2018 at 5:03
  • Tried all those duplicates you are talking about. They don't work Commented Apr 6, 2018 at 22:59

1 Answer 1

1

So the whole "magic" of the test is made in app-ea56f7.js file. This file is sending request and receiving chunks of data from netflix. Unfortunately, as referenced in Running Scripts in HtmlAgilityPack there is no direct way of having this without using a headless browser.

Either use https://www.npmjs.com/package/speedtest-net

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.