Capture HTML Input controls value of any website in window application

Deepak Puree 1 Reputation point
2022-06-20T04:42:07.77+00:00

Capture the HTML Input controls value from any website in windows application

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,278 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Jack J Jun 24,296 Reputation points Microsoft Vendor
    2022-06-21T01:55:15.057+00:00

    @Deepak Puree , Welcome to Microsoft Q&A, you could try the following steps to get input value of the website.

    First, you could try to use Webclient.DownloadString Method to download html string.

      WebClient client = new WebClient();  
      string htmlstr = client.DownloadString("url");  
    

    Second, you could use regex to get the value from the html string, here is a code example you could refer to.

        string text = "<input type=\"hidden\" id=\"taken\" value=\"BoboBobo\">\n<input type=\"hidden\" id=\"took\" value=\"BaboboBe\"";  
        Regex regex = new Regex("<input\\b.*?\\s+value\\s*=\\s*\"([^\"]*)\"");  
        foreach (Match match in regex.Matches(text))  
        {  
            Console.WriteLine(match.Groups[1].Value);  
        }  
    

    Result:

    213127-image.png

    Best Regards,
    Jack


    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more