Select field in WebBrowser

1

I need to access this link site and select the 8080 port option. Any tips?

Abs

    
asked by anonymous 29.09.2017 / 03:42

1 answer

0

I was able to select the value you need, even though the select has no id, I made a "pog" to validate for InnerText but the site still did not apply the selected value to the list, I could not identify what fires the filter.

Follow the code:

public partial class Form3 : Form
{
    public Form3()
    {
        InitializeComponent();
    }

    private void Form3_Load(object sender, EventArgs e)
    {
        webBrowser1.Navigate("https://free-proxy-list.net/");
    }

    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
        var colecao = ((WebBrowser)sender).Document.All.Cast<HtmlElement>().ToList();
        HtmlElement elemento = colecao.Find(p => p.TagName.ToLower() == "select" && p.InnerText.StartsWith("All"));
        elemento.SetAttribute("value", "8080");
    }
}
    
29.09.2017 / 04:26