我正在尝试通过使用此代码获取 id 在 webbrowser windows 表单中选择一个国家代码:
webBrowser1.Document.GetElementById("ulCountryMenu_alt").SetAttribute("value", "uk");
但它在 webbrowser 中没有改变,或者我应该使用 GetElementByTagName?
<div id="ulCountryMenu_alt">
<ul class="scroll-widget-scrollable scroll-widget-ulCountryMenu">
<li tabindex="109" data-attr-val="+93" data-attr-country-code="af"><a href="#" aria-label="AfghanistaCn"><span class="famfamfam-flag-af"></span> Afghanistan (+93)</a></li><li tabindex="109" data-attr-val="+355" data-attr-country-code="al"><a href="#" aria-label="Albania"><span class="famfamfam-flag-al"></span> Albania (+355)</a></li><li tabindex="109" data-attr-val="+213" data-attr-country-code="dz"><a href="#" aria-label="Algeria"><span class="famfamfam-flag-dz"></span> Algeria (+213)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="as"><a href="#" aria-label="American Samoa"><span class="famfamfam-flag-as"></span> American Samoa (+1)</a></li><li tabindex="109" data-attr-val="+376" data-attr-country-code="ad"><a href="#" aria-label="Andorra"><span class="famfamfam-flag-ad"></span> Andorra (+376)</a></li><li tabindex="109" data-attr-val="+244" data-attr-country-code="ao"><a href="#" aria-label="Angola"><span class="famfamfam-flag-ao"></span> Angola (+244)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="ai"><a href="#" aria-label="Anguilla"><span class="famfamfam-flag-ai"></span> Anguilla (+1)</a></li><li tabindex="109" data-attr-val="+672" data-attr-country-code="aq"><a href="#" aria-label="Antarctica"><span class="famfamfam-flag-aq"></span> Antarctica (+672)</a></li><li tabindex="109" data-attr-val="+1268" data-attr-country-code="ag"><a href="#" aria-label="Antigua, Barbuda"><span class="famfamfam-flag-ag"></span> Antigua, Barbuda (+1268)</a></li><li tabindex="109" data-attr-val="+54" data-attr-country-code="ar"><a href="#" aria-label="Argentina"><span class="famfamfam-flag-ar"></span> Argentina (+54)</a></li><li tabindex="109" data-attr-val="+374" data-attr-country-code="am"><a href="#" aria-label="Armenia"><span class="famfamfam-flag-am"></span> Armenia (+374)</a></li><li tabindex="109" data-attr-val="+297" data-attr-country-code="aw"><a href="#" aria-label="Aruba"><span class="famfamfam-flag-aw"></span> Aruba (+297)</a></li><li tabindex="109" data-attr-val="+247" data-attr-country-code="ac"><a href="#" aria-label="Ascension"><span class="famfamfam-flag-ac"></span> Ascension (+247)</a></li><li tabindex="109" data-attr-val="+61" data-attr-country-code="au"><a href="#" aria-label="Australia"><span class="famfamfam-flag-au"></span> Australia (+61)</a></li><li tabindex="109" data-attr-val="+43" data-attr-country-code="at"><a href="#" aria-label="Austria"><span class="famfamfam-flag-at"></span> Austria (+43)</a></li><li tabindex="109" data-attr-val="+994" data-attr-country-code="az"><a href="#" aria-label="Azerbaidijan"><span class="famfamfam-flag-az"></span> Azerbaidijan (+994)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="bs"><a href="#" aria-label="Bahamas"><span class="famfamfam-flag-bs"></span> Bahamas (+1)</a></li><li tabindex="109" data-attr-val="+973" data-attr-country-code="bh"><a href="#" aria-label="Bahrain"><span class="famfamfam-flag-bh"></span> Bahrain (+973)</a></li><li tabindex="109" data-attr-val="+880" data-attr-country-code="bd"><a href="#" aria-label="Bangladesh"><span class="famfamfam-flag-bd"></span> Bangladesh (+880)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="bb"><a href="#" aria-label="Barbados"><span class="famfamfam-flag-bb"></span> Barbados (+1)</a></li><li tabindex="109" data-attr-val="+375" data-attr-country-code="by"><a href="#" aria-label="Belarus"><span class="famfamfam-flag-by"></span> Belarus (+375)</a></li><li tabindex="109" data-attr-val="+32" data-attr-country-code="be"><a href="#" aria-label="Belgium"><span class="famfamfam-flag-be"></span> Belgium (+32)</a></li><li tabindex="109" data-attr-val="+501" data-attr-country-code="bz"><a href="#" aria-label="Belize"><span class="famfamfam-flag-bz"></span> Belize (+501)</a></li><li tabindex="109" data-attr-val="+229" data-attr-country-code="bj"><a href="#" aria-label="Benin"><span class="famfamfam-flag-bj"></span> Benin (+229)</a></li><li tabindex="109" data-attr-val="+1441" data-attr-country-code="bm"><a href="#" aria-label="Bermuda"><span class="famfamfam-flag-bm"></span> Bermuda (+1441)</a></li><li tabindex="109" data-attr-val="+975" data-attr-country-code="bt"><a href="#" aria-label="Bhutan"><span class="famfamfam-flag-bt"></span> Bhutan (+975)</a></li><li tabindex="109" data-attr-val="+591" data-attr-country-code="bo"><a href="#" aria-label="Bolivia"><span class="famfamfam-flag-bo"></span> Bolivia (+591)</a></li><li tabindex="109" data-attr-val="+387" data-attr-country-code="ba"><a href="#" aria-label="Bosnia & Herzegovina"><span class="famfamfam-flag-ba"></span> Bosnia & Herzegovina (+387)</a></li><li tabindex="109" data-attr-val="+267" data-attr-country-code="bw"><a href="#" aria-label="Botswana"><span class="famfamfam-flag-bw"></span> Botswana (+267)</a></li><li tabindex="109" data-attr-val="+55" data-attr-country-code="br"><a href="#" aria-label="Brazil"><span class="famfamfam-flag-br"></span> Brazil (+55)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="vg"><a href="#" aria-label="British Virgin Islands"><span class="famfamfam-flag-vg"></span> British Virgin Islands (+1)</a></li><li tabindex="109" data-attr-val="+673" data-attr-country-code="bn"><a href="#" aria-label="Brunei Darussalam"><span class="famfamfam-flag-bn"></span> Brunei Darussalam (+673)</a></li><li tabindex="109" data-attr-val="+359" data-attr-country-code="bg"><a href="#" aria-label="Bulgaria"><span class="famfamfam-flag-bg"></span> Bulgaria (+359)</a></li><li tabindex="109" data-attr-val="+226" data-attr-country-code="bf"><a href="#" aria-label="Burkina Faso"><span class="famfamfam-flag-bf"></span> Burkina Faso (+226)</a></li><li tabindex="109" data-attr-val="+257" data-attr-country-code="bi"><a href="#" aria-label="Burundi"><span class="famfamfam-flag-bi"></span> Burundi (+257)</a></li><li tabindex="109" data-attr-val="+855" data-attr-country-code="kh"><a href="#" aria-label="Cambodia"><span class="famfamfam-flag-kh"></span> Cambodia (+855)</a></li><li tabindex="109" data-attr-val="+237" data-attr-country-code="cm"><a href="#" aria-label="Cameroon"><span class="famfamfam-flag-cm"></span> Cameroon (+237)</a></li><li tabindex="109" data-attr-val="+1" data-attr-country-code="ca"><a href="#" aria-label="Canada"><span class="famfamfam-flag-ca"></span> Canada (+1)</a></li><li tabindex="109" data-attr-val="+238" data-attr-country-code="cv"><a href="#" aria-label="Cape Verde"><span class="famfamfam-flag-cv"></span> Cape Verde (+238)</a></li><li tabindex="109" data-attr-val="+1345" data-attr-country-code="ky"><a href="#" aria-label="Cayman Islands"><span class="famfamfam-flag-ky"></span> Cayman Islands (+1345)</a>