private void WorkSteps() { errorCnt = 0; selenium = new AdvSeleniumAPIv2(); selenium.StartupServer("http://" + textBox1.Text); System.Threading.Thread.Sleep(1000); selenium.Type("id=ACT0", "root"); selenium.Type("id=PWD0", "00000000"); selenium.Click("id=APY0"); selenium.WaitForPageToLoad("30000"); PrintStep(); //先確認DUT在哪個MODE底下 PrintTitle("Check DUT mode"); var mod = selenium.GetValue("id=inpWMd"); PrintStep(); // PrintTitle("Check Network Setting"); selenium.Click("id=configuration"); selenium.Click("link=Network App"); //selenium.Type("id=inpPWeb", "80"); //selenium.Click("id=btnPWeb"); // selenium.Type("id=inpIdl", "4095"); selenium.Click("id=btnIdl"); // if (mod == "Normal Mode") { System.Threading.Thread.Sleep(15000); selenium.Type("id=ACT0", "root"); selenium.Type("id=PWD0", "00000000"); selenium.Click("id=APY0"); selenium.WaitForPageToLoad("30000"); selenium.Click("id=configuration"); selenium.Click("link=Network App"); PrintStep(); } // selenium.Select("id=inpCWDT", "label=Communication WDT"); selenium.Click("id=btnCWDT"); PrintStep(); selenium.Close(); }
private void WorkSteps() { ResFlg = false; errorCnt = 0; selenium = new AdvSeleniumAPIv2(); selenium.StartupServer("http://" + textBox1.Text); System.Threading.Thread.Sleep(1000); PrintTitle("Link web"); selenium.Type("id=ACT0", "root"); selenium.Type("id=PWD0", "00000000"); selenium.Click("id=APY0"); selenium.WaitForPageToLoad("30000"); PrintStep(); //先確認DUT在哪個MODE底下 PrintTitle("Check DUT mode"); var mod = DUT_mod = selenium.GetValue("id=inpWMd"); PrintTitle("Mode is in [" + DUT_mod + "]."); PrintStep(); // if (mod == "Normal Mode") { PrintTitle("Disable item"); selenium.Click("id=configuration"); selenium.Click("link=Cloud"); var idx = selenium.GetSelectedIndex("id=selCloud"); //if(idx == "1") { selenium.Select("id=selCloud", "label= Disable"); selenium.Click("id=btnCloudDisableSubmit"); System.Threading.Thread.Sleep(1000); PrintStep(); } // PrintTitle("Check Dropbox items"); selenium.Select("id=selCloud", "label= Dropbox"); System.Threading.Thread.Sleep(1000); var idx2 = selenium.GetSelectedIndex("id=selCloud"); if (idx2 != "1") { PrintTitle("Select index fail..."); return; } PrintTitle("Open Dropbox setting page."); selenium.Click("id=btnDropBoxAuthenticate"); selenium.WaitForPopUp("", "30000"); PrintStep(); var res = selenium.GetAllWindowNames(); // PrintTitle("Operation Dropbox setting page."); selenium.SelectPopUp(res[1]); selenium.Click("//div[2]/input"); selenium.Type("//div[2]/input", "*****@*****.**"); selenium.Type("//div[2]/div[2]/input", "dqadqa"); PrintStep(); selenium.Click("css=button.login-button.button-primary"); selenium.WaitForPageToLoad("5000"); selenium.Click("//button[@name='allow_access']"); PrintStep(); selenium.WaitForPageToLoad("30000"); selenium.Click("css=input.auth-box"); PrintStep(); var DboxCode = selenium.GetValue("css=input.auth-box"); selenium.DeselectPopUp(); PrintStep(); // PrintTitle("Operation Main page."); //selenium.SelectWindow(res[0]); selenium.Click("id=carouselBtnNext"); selenium.Type("css=div.input-group > #inpCode", DboxCode);//DboxCode//"aaaa" selenium.Click("id=carouselBtnSubmit"); System.Threading.Thread.Sleep(5000); //20161026 fix for wise lan modules. if (dev.ModuleType == "WISE-4050/LAN" || dev.ModuleType == "WISE-4060/LAN" || dev.ModuleType == "WISE-4010/LAN") { selenium.Click("css=div.item.active > div.carousel-caption > p > button.btn.btn-success"); } else { selenium.Click("id=btnBack"); } PrintStep(); //check the result PrintTitle("Check link result."); System.Threading.Thread.Sleep(3000); var resCRdy = selenium.GetValue("id=inpCRdy"); PrintTitle("resCRdy is [" + resCRdy + "]."); if (resCRdy == "Token ready") { ResFlg = true; PrintTitle("Success linking...."); } else { PrintTitle("Fail link."); } PrintStep(); } else { PrintTitle("Mode is not in [Normal Mode]."); } selenium.Close(); }
private void WorkSteps() { errorCnt = 0; selenium = new AdvSeleniumAPIv2(); selenium.StartupServer("http://" + textBox1.Text); System.Threading.Thread.Sleep(1000); selenium.Type("id=ACT0", "root"); selenium.Type("id=PWD0", "00000000"); selenium.Click("id=APY0"); selenium.WaitForPageToLoad("30000"); PrintStep(); //先確認DUT在哪個MODE底下 PrintTitle("Check DUT mode"); //selenium.Click("id=information"); var mod = selenium.GetValue("id=inpWMd"); PrintStep(); // PrintTitle("Time & Date"); selenium.Click("id=configuration"); selenium.Click("link=Time & Date"); selenium.Select("id=selTZ", "label=(GMT+13:00) Nuku'alofa"); selenium.Click("id=btnTZ"); PrintStep(); // PrintTitle("Time Sync for SNTP"); selenium.Click("link=Time Sync"); selenium.Select("id=inpEnSNTP", "label=SNTP"); selenium.Type("id=inpSNTP1", "123456789012345678901234567890123456789012345678901234567890" + "ABC"); selenium.Type("id=inpSNTP2", "123456789012345678901234567890123456789012345678901234567890" + "ABC"); selenium.Type("id=inpPollingRate", "9999999"); selenium.Click("id=btnAll"); PrintStep(); PrintTitle("Mode is [" + mod + "]."); //When in infra mode would reset page. Relog-in. //Actually happen in Wireless modules. if (dev.ModuleType == "WISE-4050/LAN" || dev.ModuleType == "WISE-4060/LAN" || dev.ModuleType == "WISE-4010/LAN") { PrintTitle("Module would not restart."); } else { if (mod == "Normal Mode") { System.Threading.Thread.Sleep(15000); selenium.Type("id=ACT0", "root"); selenium.Type("id=PWD0", "00000000"); selenium.Click("id=APY0"); selenium.WaitForPageToLoad("30000"); PrintStep(); } } // PrintTitle("Time Sync for WA"); selenium.Click("id=configuration"); selenium.Click("link=Time Sync"); selenium.Select("id=inpEnSNTP", "label=WebAccess"); selenium.Click("id=btnAll"); PrintStep(); //When in infra mode would reset page. Relog-in. if (dev.ModuleType == "WISE-4050/LAN" || dev.ModuleType == "WISE-4060/LAN" || dev.ModuleType == "WISE-4010/LAN") { PrintTitle("Module would not restart."); } else { if (mod == "Normal Mode") { System.Threading.Thread.Sleep(15000); selenium.Type("id=ACT0", "root"); selenium.Type("id=PWD0", "00000000"); selenium.Click("id=APY0"); selenium.WaitForPageToLoad("30000"); PrintStep(); } } // PrintTitle("General Setting"); selenium.Click("id=configuration"); selenium.Click("link=General"); selenium.Type("id=inpPollingRate", "9999999"); selenium.Click("id=btnPollingRate"); selenium.Click("id=inpEnWF"); selenium.Click("id=inpEnWF"); selenium.Click("id=btnEnWF"); PrintStep(); selenium.Close(); }
private void WorkSteps() { ResFlg = false; errorCntStep = 0; // 取得本機名稱 string strHostName = Dns.GetHostName(); // 取得本機的IpHostEntry類別實體,MSDN建議新的用法 IPHostEntry iphostentry = Dns.GetHostEntry(strHostName); // 取得所有 IP 位址 System.Collections.ArrayList ipList = new System.Collections.ArrayList(); foreach (IPAddress ipaddress in iphostentry.AddressList) { // 只取得IP V4的Address if (ipaddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { ipList.Add(ipaddress.ToString()); //Console.WriteLine("Local IP: " + ipaddress.ToString()); } } if (ipList.Count < 1) { PrintTitle("Get Host IP fail."); return; } string[] HostIP = new string[ipList.Count]; int i = 0; foreach (var item in ipList) { HostIP[i] = (string)item; i++; } // //#if Debug devMac = ""; selenium = new AdvSeleniumAPIv2(); selenium.StartupServer("http://" + textBox1.Text); System.Threading.Thread.Sleep(1000); selenium.Type("id=ACT0", "root"); selenium.Type("id=PWD0", "00000000"); selenium.Click("id=APY0"); selenium.WaitForPageToLoad("30000"); PrintStep(); //先確認DUT在哪個MODE底下 PrintTitle("Check DUT mode"); var mod = DUT_mod = selenium.GetValue("id=inpWMd"); PrintStep(); // if (mod == "Normal Mode") { PrintTitle("Get device MAC address"); selenium.Click("id=configuration"); if (dev.ModuleType.ToUpper() == "WISE-4050/LAN" || dev.ModuleType.ToUpper() == "WISE-4060/LAN" || dev.ModuleType.ToUpper() == "WISE-4010/LAN") { selenium.Click("link=Network"); } else { selenium.Click("link=Wireless"); } devMac = selenium.GetValue("id=inpMAC"); PrintStep(); PrintTitle("Get MAC address is [" + devMac + "]"); // PrintTitle("Check Private Server items"); selenium.Click("id=configuration"); selenium.Click("link=Cloud"); selenium.Select("id=selCloud", "label= Private Server"); selenium.Type("id=logIP", HostIP[0]); selenium.Type("id=logPWeb", "8000"); selenium.Type("id=logUurl", "/upload_log"); selenium.Type("id=logDurl", "/io_log"); selenium.Type("id=logSurl", "/sys_log"); selenium.Click("id=RadioSslDisable"); selenium.Click("id=btnPrivateServerSubmit"); selenium.Type("id=logPu", "root"); selenium.Type("id=logPw", "00000000"); PrintStep(); // PrintTitle("Enable [By Period] checkbox"); selenium.Click("id=configuration"); selenium.Click("id=advancedFunction"); selenium.Click("id=dataLog"); selenium.Type("id=inpPItv", "1"); var res = selenium.GetValue("id=inpPer"); if (selenium.GetValue("id=inpPer") == "off") { selenium.Click("id=inpPer"); } selenium.Click("id=btnLogConfigAll"); PrintStep(); // selenium.Click("id=advancedFunction"); selenium.Click("id=dataLog"); selenium.Click("link=Logger Configuration"); PrintTitle("Enable [IO Log] checkbox"); if (selenium.GetValue("id=memDEn") == "off") { selenium.Click("id=memDEn"); } PrintStep(); PrintTitle("Enable [Cloud Upload] checkbox"); if (selenium.GetValue("id=cloudEn") == "off") { selenium.Click("id=cloudEn"); } selenium.Select("id=selDEn", "label=Item Periodic Interval mode"); selenium.Type("id=inpDItm", "1"); selenium.Type("id=inpDTag", "WISE_PrvSrv_AUTOTEST"); if (selenium.GetValue("id=pushDEn") == "off") { selenium.Click("css=#push_output > div.form-group.row > div.col-lg-12 > div.col-sm-10 > div.input-group > div.SliderSwitch > label.SliderSwitch-label > span.SliderSwitch-inner"); } selenium.Click("id=btnLoggerConfigSubmit"); PrintStep(); } else { PrintTitle("Mode is not in [Normal Mode]."); } // selenium.Close(); //#endif // StartListener(); int WDT = 0; while (Listening) { PrintTitle("Listening"); Application.DoEvents(); if (WDT > 999) { PrintTitle("Timeout...."); break; } WDT++; } }