none
accessing HTML webpage through C# or script RRS feed

  • Question

  • Hello All:

    I have a HTML webpage as shown below:

    I would like to perform following operations through C# or through any other scrip

    - Select one the check box

    - Click on dropdown list and select one of the lists from there.

    Is it possible to do something like this through C# or any other scripts instead of doing it on the webpage directly?

    Please let me know

    Thank you,

    Shwetha


    • Edited by Shwegc Friday, May 10, 2019 6:32 PM
    Friday, May 10, 2019 6:30 PM

All replies

  • If is only small task in the web page, I recommend you to use a google extension IMicros (You can record what to do, and after the macro will repeat the actions for you)
    https://chrome.google.com/webstore/detail/imacros-for-chrome/cplklnmnlbnpmjogncfgfijoopmnlemp
    Friday, May 10, 2019 6:51 PM
  • You can use UI Automation

    You can do some tests (and see the hierarchy of controls) with Inspect tool from the Windows SDK

    Friday, May 10, 2019 7:11 PM
  • Hi Shwegc,

    Thank you for posting here.

    Based on your description, you want to perform some operations in a html webpage via c#.

    You could try to use InvokeMember method, I write a simple code for it. Besides, it is a winform application, I used WebBrowser control.

    HTML

    <div class="resouce myapps-myfolder"title="Cert" isfolder="true" folder-path="Main/Cert"><a class="myapp" title="Cert" href="https://docs.microsoft.com/en-us/"> Cert</a>
    </div>

    Code:

    private void btnCert_Click(object sender, EventArgs e)
            {
                HtmlElementCollection links = wbCerner.Document.GetElementsByTagName("a");
                foreach (HtmlElement link in links)
                {
                    var m = link.GetAttribute("title");
                    if (m != null && m == "Cert")
                    {
                        link.InvokeMember("Click");
                    }
                }
            }

    Result:

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 13, 2019 2:29 AM
    Moderator