WebBrowser control HTMLDocument automate selecting option drop-down

后端 未结 7 2186
栀梦
栀梦 2021-02-02 00:33

I\'m trying to automate in a WinForm using a WebBrowser control to navigate and pull report info from a website. You can enter values in textboxes and invoke the click events fo

7条回答
  •  [愿得一人]
    2021-02-02 01:09

    You will have to select the selected attribute on the option you want.

    Given:

    
    

    The following would selct the third option:

    webBrowser1.Document
               .GetElementById("")
               .Children.GetElementsByName("option")[2]
               .SetAttribute("selected", "selected");
    

提交回复
热议问题