/// <summary> /// 下拉菜单点击 /// </summary> /// <param name="str">显示内容</param> /// <param name="nopanduan">不判断是否选中,直接点击</param> void DropdownCheck(string str, bool nopanduan = true) { //循环5次,每次加150 int len = 150; for (int i = 0; i < 5; i++) { DropdownSetScroll(i * len); DropdownSetScroll_Sheng(i * len); Manager.Delay(300); //获取li的数量 int licount = chrome.JS_CEFBrowserToInt("getElementsByClassName_Vague('" + classname_dropdown + "')[0].getElementsByTagName('li').length"); //循环li for (int j = 0; j < licount; j++) { //判断每个li的文字中是否有制定文字 string temp = chrome.JS_CEFBrowser("getElementsByClassName_Vague('" + classname_dropdown + "')[0].getElementsByTagName('li')[" + j + "].innerText"); //如果有 if (temp.IndexOf(str) > -1) { if (nopanduan) { //string temptemp = chrome.JS_CEFBrowser("getElementsByClassName_Vague('" + classname_check + "')[" + (jj) + "].checked==true"); string temptemp = chrome.JS_CEFBrowser("getElementsByClassName_Vague('" + classname_dropdown + "')[0].getElementsByTagName('li')[" + j + "].getElementsByTagName('input')[0].checked==true"); //则判断是否已经被选中 +8 是跳过下面的合并订单等选项 if (temptemp.ToUpper() == "FALSE") { //如果没有选中则选中 ClickDropdown(j); } } else { ClickDropdown(j); } } } } ClickOther(); }
void DropdownCheck(string str, bool nopanduan = true) { //循环5次,每次加150 int len = 150; for (int i = 0; i < 5; i++) { DropdownSetScroll(i * len); DropdownSetScroll_Sheng(i * len); wait(); //获取li的数量 int licount = chrome.JS_CEFBrowserToInt("document.getElementsByClassName('" + classname_dropdown + "')[0].getElementsByTagName('li').length"); //循环li for (int j = 0; j < licount; j++) { //判断每个li的文字中是否有制定文字 string temp = chrome.JS_CEFBrowser("document.getElementsByClassName('" + classname_dropdown + "')[0].getElementsByTagName('li')[" + j + "].innerText"); //如果有 if (temp.IndexOf(str) > -1) { if (nopanduan) { //则判断是否已经被选中 if (!chrome.JS_CEFBrowserToBool("document.getElementsByClassName('" + classname_dropdown + "')[0].getElementsByClassName('" + classname_check + "')[" + j + "].checked==true")) { //如果没有选中则选中 ClickDropdown(j); } } else { ClickDropdown(j); } } } } chrome.MouseLeftByHtmlElement("document.getElementsByClassName('Grid_row_4-62-1')[0].getElementsByTagName('label')[0]", true); }