I am trying to select item from select list box using this method:
var elements = webBrowser1.Document.GetElementsByTagName("select");
foreach (HtmlElement element in elements)
{
if (element.GetAttribute("id")=="pagesize")
{
element.GetElementsByTagName("option")[2].SetAttribute("selected", "selected");
webBrowser1.Document.InvokeMember("click");
}
}
from this html code
<select name="pagesize" id="pagesize" onchange="changeFileListRequestSize();">
<option value="10">10 files per page</option>
<option value="25" selected="selected">25 files per page</option>
<option value="50">50 files per page</option>
<option value="100">100 files per page</option>
<option value="200">200 files per page</option>
</select>
item is actually changes but that's doesn't execute onchange="changeFileListRequestSize();" javascript event.
how to simulate select list item click or "change"
document.GetElementById("pageSize").InvokeMember("onchange")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With