Exemplo n.º 1
0
    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();
        //
        PrintTitle("Check Logger Query");
        selenium.Click("id=advancedFunction");
        selenium.Click("id=dataLog");
        selenium.Click("link=Local Data Query");
        selenium.Click("id=inpMAC");
        selenium.Select("css=div.col-md-5 > #selTmF", "label=Local Date and Time(GMT)");
        selenium.Select("id=selFltr", "label=Amount of Latest Data");
        selenium.Click("id=btnQuery");
        selenium.Click("id=btnClear");
        selenium.Click("id=btnCommonConfirm");
        selenium.Click("link=System Data Query");
        selenium.Click("css=#collapseSysFormatConfig > div.form-group > div.col-md-3 > div.checkbox > label > #inpMAC");
        selenium.Select("css=#collapseSysFormatConfig > div.form-group > div.col-md-5 > #selTmF", "label=Local Date and Time(GMT)");
        selenium.Select("css=#collapseSysModeConfig > div.form-group > div.col-md-9 > #selFltr", "label=Amount of Latest Data");
        selenium.Click("css=#panelSystemLogViewer > div.panel-footer.clearfix > center > div.btn-group > #btnQuery");
        selenium.Click("css=#panelSystemLogViewer > div.panel-footer.clearfix > center > div.btn-group > #btnClear");
        selenium.Click("id=btnCommonConfirm");
        PrintStep();
        selenium.Close();
    }
Exemplo n.º 2
0
    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();
        //
        PrintTitle("Check Logger Config");
        selenium.Click("id=advancedFunction");
        selenium.Click("id=dataLog");
        selenium.Click("link=Logger Configuration");
        selenium.Click("id=memDEn");
        selenium.Click("id=memSEn");
        selenium.Click("//div[@id='panelLoggerConfig']/div/form/div[2]/div/div/div/div/label/span[2]");

        selenium.Click("//div[@id='panelLoggerConfig']/div/form/div[2]/div/div/div/div/label/span");
        selenium.Click("id=cloudEn");
        selenium.Click("css=#cloudUploadSetting > div.form-group.row > div.col-lg-12 > div.col-sm-10 > div.input-group > div.SliderSwitch > label.SliderSwitch-label > span.SliderSwitch-inner");
        selenium.Select("id=logFn", "label=YYYYMMDD");
        selenium.Select("id=logTmF", "label=Local Date and Time(GMT)");
        selenium.Select("id=selDEn", "label=Item Periodic Interval mode");
        selenium.Type("id=inpDItm", "10000");
        selenium.Type("id=inpDTag", "123456789012345678901234567890123456789012345678901234567890ABC123456789012345678901234567890123456789012345678901234567890ABC1");
        selenium.Select("id=selSEn", "label=Item Periodic Interval mode");
        selenium.Type("id=inpSItm", "10000");
        selenium.Type("id=inpSTag", "123456789012345678901234567890123456789012345678901234567890ABC123456789012345678901234567890123456789012345678901234567890ABC1");
        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-switch");
        selenium.Click("//span[@id='push_output']/div[2]/div/div/div/div/label/span");
        selenium.Click("id=logMAC");
        selenium.Select("id=selTmF", "label=Local Date and Time(GMT)");
        selenium.Click("id=btnLoggerConfigSubmit");
        PrintStep();
        //
        selenium.Click("id=memDEn");
        selenium.Click("id=memSEn");
        selenium.Select("id=logFn", "label=YYYYMMDDHHMMSS");
        selenium.Select("id=logTmF", "label=Coordinated Universal Time(UTC)");
        selenium.Select("id=selDEn", "label=Time Periodic Interval mode");
        selenium.Type("id=inpDTim", "864000");
        selenium.Type("id=inpDTag", "123456789012345678901234567890123456789012345678901234567890ABC123456789012345678901234567890123456789012345678901234567890ABC1");
        selenium.Select("id=selSEn", "label=Time Periodic Interval mode");
        selenium.Type("id=inpSTim", "864000");
        selenium.Type("id=inpSTag", "123456789012345678901234567890123456789012345678901234567890ABC123456789012345678901234567890123456789012345678901234567890ABC1");
        selenium.Click("id=logMAC");
        selenium.Click("id=logTIM");
        selenium.Click("id=btnLoggerConfigSubmit");
        PrintStep();
        selenium.Close();

        //
        eStatus(this, new StatusEventArgs(iStatus.Completion));
        eResult(this, new ResultEventArgs(iResult.Pass));
    }
Exemplo n.º 3
0
    private void WorkSteps()
    {
        if (!AIModChkBlock())
        {
            PrintTitle("Module not support.");
            return;
        }
        //
        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();
        //
        UIConfgBlock();
        //AIConfgStsBlock();
        AIConfgChnBlock();
        AIConfgComBlock();

        selenium.Close();
    }
Exemplo n.º 4
0
    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();
        //
        PrintTitle("Check Info items");
        selenium.Click("id=configuration");
        selenium.Type("id=inpUID", "123456789012345678901234567890A");
        selenium.Type("id=inpNm", "123456789012345678901234567890123456789012345678901234567890ABC");
        selenium.Type("id=inpDes", "123456789012345678901234567890123456789012345678901234567890"
                      + "123456789012345678901234567890123456789012345678901234567890"
                      + "ABCDEFG");
        selenium.Type("id=inpLat", "1234567890ABCDE");
        selenium.Type("id=inpAlt", "1234567890ABCDE");
        selenium.Type("id=inpLoc", "123456789012345678901234567890123456789012345678901234567890"
                      + "123456789012345678901234567890123456789012345678901234567890"
                      + "ABCDEFG");
        selenium.Type("id=inpLng", "1234567890ABCDE");
        selenium.Click("id=btnCommonInfo");
        PrintStep();
        selenium.Close();

        //
        eStatus(this, new StatusEventArgs(iStatus.Completion));
        eResult(this, new ResultEventArgs(iResult.Pass));
    }
Exemplo n.º 5
0
    private void WorkSteps()
    {
        // 取得本機名稱
        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());
            }
        }
        //
        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();
        //
        PrintTitle("Access Control");
        selenium.Click("id=advancedFunction");
        selenium.Click("id=accessCtrl");

        int cnt = 0;

        foreach (var item in ipList)
        {
            selenium.Click("id=checkboxAccessCtrlEnable" + cnt.ToString());
            selenium.Type("id=txtbarAccessCtrlAddress" + cnt.ToString(), (string)item);
            cnt++;
        }
        PrintStep();
        for (int i = ipList.Count; i < 8; i++)
        {
            selenium.Click("id=checkboxAccessCtrlEnable" + i.ToString());
            selenium.Type("id=txtbarAccessCtrlAddress" + i.ToString(), "192.168.1." + i.ToString());
        }

        selenium.Click("id=btnSubmit");
        PrintStep();
        selenium.Close();
    }
Exemplo n.º 6
0
    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();
        //
        PrintTitle("Check Aliyun OSS items");
        selenium.Click("id=configuration");
        selenium.Click("link=Cloud");
        selenium.Select("id=selCloud", "label=  Aliyun OSS");
        selenium.Type("id=logNm", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL");
        selenium.Type("id=logEn", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL");
        selenium.Type("id=logId", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL");
        selenium.Type("id=logAKey", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL");
        selenium.Click("id=btnAliyunSubmit");
        PrintStep();
        //
        PrintTitle("Check Private Server items");
        selenium.Select("id=selCloud", "label=  Private Server");
        selenium.Type("id=logIP", "999.999.999.999.999.999.999.999.999.999.999.999.999.999.999.999A");
        selenium.Type("id=logPWeb", "65535");
        selenium.Type("id=logUurl", "/abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijab@");
        selenium.Type("id=logDurl", "/12345678901234567890123456789012345678901234567890123456789012X");
        selenium.Type("id=logSurl", "/ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJAB$");
        selenium.Click("id=RadioSslEnable");
        selenium.Type("id=logPu", "12345678901234567890123456789012");
        selenium.Type("id=logPw", "1234567890ABCDEF");
        selenium.Click("id=btnPrivateServerSubmit");
        PrintStep();
        //
        PrintTitle("Check WebAccess items");
        selenium.Select("id=selCloud", "label=  WebAccess");
        selenium.Type("id=Nm", "999.999.999.999.999.999.999.999.999.999.999.999.999.999.999.999A");
        selenium.Type("id=PNm", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF");
        selenium.Type("id=NNm", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF");
        selenium.Type("id=HbF", "65535");
        selenium.Type("id=PWeb", "65535");
        selenium.Click("id=waSslEnable");
        selenium.Type("id=Pu", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF");
        selenium.Type("id=Pw", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF");
        selenium.Click("id=btnWebAccessSubmit");
        PrintStep();

        selenium.Close();
    }
Exemplo n.º 7
0
    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();
    }
Exemplo n.º 8
0
    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");
        selenium.Click("id=configuration");
        selenium.Click("link=Account");
        PrintStep();
        //
        PrintTitle("Root Account");
        selenium.Click("id=btnPasswordChange_Id0");
        selenium.Type("id=inpOldPassword", "00000000");
        selenium.Type("id=inpNewPassword", "00000000");
        selenium.Type("id=inpConfirm", "00000000");
        selenium.Click("id=btnPw"); System.Threading.Thread.Sleep(1000);
        PrintStep();
        //
        PrintTitle("Admin Account");
        selenium.Click("id=btnPasswordChange_Id2");
        selenium.Type("id=inpOldPassword", "00000000");
        selenium.Type("id=inpNewPassword", "00000000");
        selenium.Type("id=inpConfirm", "00000000");
        selenium.Click("id=btnPw"); System.Threading.Thread.Sleep(1000);
        PrintStep();
        //
        PrintTitle("User Account");
        selenium.Click("id=btnPasswordChange_Id1");
        selenium.Type("id=inpOldPassword", "00000000");
        selenium.Type("id=inpNewPassword", "00000000");
        selenium.Type("id=inpConfirm", "00000000");
        selenium.Click("id=btnPw"); System.Threading.Thread.Sleep(1000);
        PrintStep();

        selenium.Close();
    }
Exemplo n.º 9
0
    private void WorkSteps()
    {
        if (!DIModChkBlock())
        {
            PrintTitle("Module not support.");
            return;
        }
        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();
        //
        if (dev.ModuleType.ToUpper() == "WISE-4012")
        {
            UIConfgBlock();
            UDIExeDIconfig();
            UDIExeCntconfig();
            UDIExeL2Hconfig();
            UDIExeH2Lconfig();
        }
        else
        {
            DIExeDIconfig();
            DIExeCntconfig();
            DIExeL2Hconfig();
            DIExeH2Lconfig();
            DIExeFreqconfig();
        }



        selenium.Close();
    }
Exemplo n.º 10
0
    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();
        //
        if (dev.ModuleType == "WISE-4050/LAN" ||
            dev.ModuleType == "WISE-4060/LAN" ||
            dev.ModuleType == "WISE-4010/LAN")
        {
            PrintTitle("Setting Wireless Config in Network Mode...");
            selenium.Click("id=configuration");
            selenium.Click("link=Network");
            selenium.Type("id=inpIP", AddressIP);
            selenium.Type("id=inpMsk", "255.255.0.0");
            selenium.Type("id=inpGW", "192.168.0.1");
            selenium.Click("id=RadioIpDHCP");
            selenium.Click("id=RadioIpStatic");
            selenium.Click("id=btnNetworkConfig");
            PrintStep();
            System.Threading.Thread.Sleep(10000);
        }
        else
        {
            if (chkMod.Checked)
            {
                PrintTitle("Setting Wireless Config in AP Mode...");
                selenium.Click("id=configuration");
                selenium.Click("link=Wireless");
                selenium.Select("id=selMd", "label=Infrastructure Mode");
                selenium.Type("id=inpISSID", "123456789012345678901234567890AB");
                selenium.Select("id=selISec", "label=Security WPA/WPA2");
                selenium.Type("id=inpIKey", "123456789012345678901234567890123456789012345678901234567890ABC");
                selenium.Type("id=inpISSID2", "123456789012345678901234567890AB");
                selenium.Select("id=selISec2", "label=Security WPA/WPA2");
                selenium.Type("id=inpIKey2", "123456789012345678901234567890123456789012345678901234567890ABC");
                selenium.Type("id=inpIP", AddressIP);
                selenium.Type("id=inpMsk", "255.255.255.248");
                selenium.Type("id=inpGW", "255.255.255.254");
                selenium.Click("id=inpIpStatic");
                selenium.Click("id=btnWLanConfig");
                PrintStep();
                //
                selenium.Select("id=selMd", "label=AP Mode");
                selenium.Type("id=inpASSID", "WISE-40XX-Test");
                selenium.Click("id=inpAHid");
                selenium.Select("id=selACnty", "label=EU (1~13)");
                selenium.Type("id=inpACh", "13");
                selenium.Select("id=selASec", "label=Security WPA/WPA2");
                selenium.Type("id=inpAKey", "123456789012345678901234567890123456789012345678901234567890ABC");
                selenium.Click("id=btnWLanConfig");
                PrintStep();
            }
            else
            {
                PrintTitle("Setting Wireless Config in Infra Mode...");
                selenium.Click("id=configuration");
                selenium.Click("link=Wireless");
                selenium.Select("id=selMd", "label=Infrastructure Mode");
                selenium.Type("id=inpISSID", "IAG_DQA_LAB");
                selenium.Select("id=selISec", "label=Security WPA/WPA2");
                selenium.Type("id=inpIKey", "00000000");
                selenium.Type("id=inpIP", AddressIP);
                selenium.Type("id=inpMsk", "255.255.0.0");
                selenium.Type("id=inpGW", "192.168.0.1");
                selenium.Click("id=inpIpStatic");
                selenium.Click("id=btnWLanConfig");
                PrintStep();
            }
        }


        selenium.Close();
    }
Exemplo n.º 11
0
    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();
        //
        PrintTitle("Check IO Config");
        selenium.Click("id=configuration");
        selenium.Click("id=advancedFunction");
        selenium.Click("id=dataLog");
        selenium.Type("id=inpPItv", "65535");
        selenium.Click("id=inpPer");
        selenium.Click("id=inpCWDT");
        selenium.Click("id=inpPer");
        selenium.Click("id=inpCWDT");
        selenium.Click("id=inpRst");
        selenium.Click("id=inpCir");
        PrintStep();
        if (dev.ModuleType == "WISE-4050" || dev.ModuleType == "WISE-4060")
        {
            selenium.Click("id=cbChCOS0");
            selenium.Click("id=cbChCOS1");
            selenium.Click("id=cbChCOS2");
            selenium.Click("id=cbChCOS3");
            selenium.Click("link=DO/Relay");
            selenium.Click("xpath=(//input[@id='cbChCOS0'])[2]");
            selenium.Click("xpath=(//input[@id='cbChCOS1'])[2]");
            selenium.Click("xpath=(//input[@id='cbChCOS2'])[2]");
            selenium.Click("xpath=(//input[@id='cbChCOS3'])[2]");
        }
        else if (dev.ModuleType == "WISE-4012")
        {
            selenium.Click("id=aiChannelTabId");
            selenium.Click("xpath=(//input[@id='cbChCOS0'])[2]");
            selenium.Click("xpath=(//input[@id='cbChCOS1'])[2]");
            selenium.Click("id=cbChCOS2");
            selenium.Click("id=cbChCOS3");
            selenium.Click("id=cbChCOSAvg");
            selenium.Click("id=cbChUIO0");
            selenium.Click("id=cbChUIO1");
            selenium.Click("id=cbChUIO2");
            selenium.Click("id=cbChUIO3");
        }

        selenium.Click("id=btnLogConfigAll");
        PrintStep();
        //
        PrintTitle("Check System Configuration");
        selenium.Click("link=System Configuration");
        selenium.Click("id=inpCOMMUNICATE_WDT");
        selenium.Click("id=inpCLOUD_UPLOAD_FAIL");
        selenium.Click("id=inpCLOUD_PUSH_FAIL");
        selenium.Click("id=inpSNTP_FAIL");
        selenium.Click("id=inpMEMORY_FULL_OVERWRITE");
        selenium.Click("id=inpACCESS_CONTROL_FAIL");
        selenium.Click("id=inpPW_ERROR");
        selenium.Click("id=inpFW_UPGRADE");
        selenium.Click("id=inpBATTERY_LOW");
        selenium.Click("id=btnLogSysConfig");
        PrintStep();
        selenium.Close();
    }
Exemplo n.º 12
0
Arquivo: Form1.cs Projeto: IAGDQA/WISE
    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();
    }
Exemplo n.º 13
0
    private void WorkSteps()
    {
        PrintTitle("Check folder path.");
        errorCnt = 0;
        string filepath = GCtxtBox.Text;

        if (filepath == "" || filepath == null)
        {
            PrintTitle("Path failed!");
            return;
        }

        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();
        //
        selenium.Click("id=configuration");
        selenium.Click("link=Firmware");
        selenium.Click("id=groupConfigIpSettingBtn");
        selenium.Click("link=With IP Settings");
        selenium.Click("id=inpGroupConfig");
        PrintStep();
        //
        String pathToFile = "";

        if (dev.ModuleType.ToUpper() == "WISE-4012E")
        {
            pathToFile = @filepath + "\\config_file_wise4012e.cfg";
        }
        else if (dev.ModuleType.ToUpper() == "WISE-4012")
        {
            pathToFile = @filepath + "\\config_file_wise4012.cfg";
        }
        else if (dev.ModuleType.ToUpper() == "WISE-4051")
        {
            pathToFile = @filepath + "\\config_file_wise4051.cfg";
        }
        else if (dev.ModuleType.ToUpper() == "WISE-4050")
        {
            pathToFile = @filepath + "\\config_file_wise4050.cfg";
        }
        else if (dev.ModuleType.ToUpper() == "WISE-4060")
        {
            pathToFile = @filepath + "\\config_file_wise4060.cfg";
        }
        else if (dev.ModuleType.ToUpper() == "WISE-4050/LAN")
        {
            pathToFile = @filepath + "\\config_file_wise4050lan.cfg";
        }
        else if (dev.ModuleType.ToUpper() == "WISE-4060/LAN")
        {
            pathToFile = @filepath + "\\config_file_wise4060lan.cfg";
        }
        else if (dev.ModuleType.ToUpper() == "WISE-4010/LAN")
        {
            pathToFile = @filepath + "\\config_file_wise4010lan.cfg";
        }

        //
        System.Threading.Thread.Sleep(3000); int Main_Handl = 0;
        int iLoginKeyboard_Handle = tpc.F_FindWindow("#32770", "上傳檔案");
        int iIE_Handl_1           = tpc.F_FindWindowEx(iLoginKeyboard_Handle, 0, "ComboBoxEx32", "");
        int iIE_Handl_2           = tpc.F_FindWindowEx(iIE_Handl_1, 0, "ComboBox", "");

        Main_Handl = tpc.F_FindWindowEx(iIE_Handl_2, 0, "Edit", "");

        if (Main_Handl > 0)
        {
            System.Threading.Thread.Sleep(1000);
            SendCharToHandle(Main_Handl, 1, pathToFile);
            System.Threading.Thread.Sleep(1000);
            tpc.F_PostMessage(Main_Handl, tpc.V_WM_KEYDOWN, tpc.V_VK_RETURN, 0);
            System.Threading.Thread.Sleep(1000);
            //
            selenium.Click("//a[@id='btnGroupConfig']/i");
            PrintStep();
            System.Threading.Thread.Sleep(20000);//delay 20sec
        }
        else
        {
            PrintTitle("Get Handle Fail.");
        }
        //MessageBox.Show("Get Handle Fail.");
        //
        //System.Threading.Thread.Sleep(3000);
        //SendKeys.SendWait(pathToFile);
        //System.Threading.Thread.Sleep(3000);
        //SendKeys.SendWait("{ENTER}");

        PrintTitle("Browser close.");
        selenium.Close();
    }
Exemplo n.º 14
0
    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();
    }
Exemplo n.º 15
0
    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();
        //
        PrintTitle("Modubus Coils");
        selenium.Click("id=configuration");
        selenium.Click("link=Modbus");
        if (dev.ModuleType == "WISE-4050" || dev.ModuleType == "WISE-4060")
        {
            selenium.Type("id=basDI", "11");
            selenium.Type("id=basDO", "171");
            selenium.Type("id=basCtS", "331");
            selenium.Type("id=basCtClr", "371");
            selenium.Type("id=basCtOv", "411");
            selenium.Type("id=basLch", "451");
            selenium.Type("id=basLB", "9999");
            selenium.Click("id=btnModbusCoilSubmit");
        }
        else if (dev.ModuleType == "WISE-4012")
        {
            selenium.Type("id=basDI", "11");
            selenium.Type("id=basDO", "171");
            selenium.Type("id=basCtS", "331");
            selenium.Type("id=basCtClr", "37");
            selenium.Type("id=basCtClr", "371");
            selenium.Type("id=basCtOv", "411");
            selenium.Type("id=basLch", "451");
            selenium.Type("id=basAIHR", "1011");
            selenium.Type("id=basAILR", "1111");
            selenium.Type("id=basAIB", "1211");
            selenium.Type("id=basHAlm", "1311");
            selenium.Type("id=basLAlm", "1411");
            selenium.Type("id=basLB", "9999");
            selenium.Click("id=btnModbusCoilSubmit");
        }
        else if (dev.ModuleType == "WISE-4012")
        {
            selenium.Type("id=basLB", "9999");
            selenium.Type("id=basExB", "8888");
            selenium.Type("id=basLch", "571");
            selenium.Type("id=basCtOv", "491");
            selenium.Type("id=basCtClr", "411");
            selenium.Type("id=basCtS", "331");
            selenium.Type("id=basDI", "11");
            selenium.Click("id=btnModbusCoilSubmit");
        }

        PrintStep();
        PrintTitle("Modubus Registors");
        selenium.Click("id=modbusAddrRegConfig");
        if (dev.ModuleType == "WISE-4050" || dev.ModuleType == "WISE-4060")
        {
            selenium.Type("id=basPsLo", "91");
            selenium.Type("id=basPsHi", "171");
            selenium.Type("id=basCtFq", "11");
            selenium.Type("id=basPsAV", "251");
            selenium.Type("id=basPsIV", "331");
            selenium.Type("id=basMNm", "2111");
            selenium.Type("xpath=(//input[@id='basDI'])[2]", "3011");
            selenium.Type("xpath=(//input[@id='basDO'])[2]", "3031");
            selenium.Type("id=basCntIV", "4011");
        }
        else if (dev.ModuleType == "WISE-4012")
        {
            selenium.Type("id=basCntIV", "4011");
            selenium.Type("xpath=(//input[@id='basDO'])[2]", "3031");
            selenium.Type("xpath=(//input[@id='basDI'])[2]", "3011");
            selenium.Type("id=basAICh", "2211");
            selenium.Type("id=basMNm", "2111");
            selenium.Type("id=basAIPF", "2311");
            selenium.Type("id=basAICd", "2011");
            selenium.Type("id=basAISc", "1911");
            selenium.Type("id=basHisLF", "1711");
            selenium.Type("id=basHisHF", "1511");
            selenium.Type("id=basAIF", "1311");
            selenium.Type("id=basHisL", "1211");
            selenium.Type("id=basHisH", "1111");
            selenium.Type("id=basAIFl", "1011");
            selenium.Type("id=basPsIV", "371");
            selenium.Type("id=basPsAV", "331");
            selenium.Type("id=basPsHi", "291");
            selenium.Type("id=basPsLo", "251");
            selenium.Type("id=basCtFq", "171");
            selenium.Type("id=basAI", "11");
        }
        else if (dev.ModuleType == "WISE-4051")
        {
            selenium.Type("id=basLg", "9999");
            selenium.Type("id=basExWE", "8888");
            selenium.Type("id=basExBE", "7777");
            selenium.Type("id=basExW", "6666");
            selenium.Type("xpath=(//input[@id='basDI'])[2]", "3011");
            selenium.Type("id=basMNm", "2111");
            selenium.Type("id=basCtFq", "11");
        }
        selenium.Type("id=basLg", "9999");
        //Only wireless module support.
        if (dev.ModuleType != "WISE-4050/LAN" ||
            dev.ModuleType != "WISE-4060/LAN" ||
            dev.ModuleType != "WISE-4010/LAN")
        {
            selenium.Type("id=basRssi", "9998");
        }

        selenium.Click("id=btnModbusRegSubmit");

        PrintStep();
        selenium.Close();
    }
Exemplo n.º 16
0
    private void WorkSteps()
    {
        errorCnt = 0;
        if (dev.ModuleType == "WISE-4051")
        {
            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();
            for (int i = 0; i < 1; i++)
            {
                selenium.Click("id=ioStatus0");
                selenium.Click("link=COM1");
                selenium.Click("link=Modbus/RTU Configuration");
                if (i > 0)
                {
                    selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div/form/div/div/div/div/select"
                                    , "label=9600 bps");
                    selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div/form/div/div/div[2]/div/select"
                                    , "label=7 bit");
                    selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div/form/div/div/div[3]/div/select"
                                    , "label=Odd");
                    selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div/form/div/div/div[4]/div/select"
                                    , "label=1 bit");
                    PrintStep();
                }
                else
                {
                    selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div/form/div/div/div/div/select"
                                    , "label=115200 bps");
                    selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div/form/div/div/div[2]/div/select"
                                    , "label=8 bit");
                    selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div/form/div/div/div[3]/div/select"
                                    , "label=Even");
                    selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div/form/div/div/div[4]/div/select"
                                    , "label=2 bit");
                    PrintStep();
                }

                selenium.Type("xpath=(//input[@type='number'])[11]", "5000");
                selenium.Type("xpath=(//input[@type='number'])[12]", "1000");
                selenium.Click("name=004");
                //
                selenium.Click("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div/form/div[2]/div/button");
                selenium.Click("link=Rule Setting");
                PrintStep();

                //rule 01
                selenium.Type("xpath=(//input[@type='number'])[13]", "20" + i.ToString());
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr/td[3]/select"
                                , "label=01 Coil status");
                selenium.Type("xpath=(//input[@type='number'])[14]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[15]", "4");
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr/td[6]/select"
                                , "label=R/W");
                selenium.Type("xpath=(//input[@type='number'])[16]", "999" + i.ToString());
                selenium.Click("xpath=(//input[@type='checkbox'])[19]");
                PrintStep();

                //rule 02
                selenium.Type("xpath=(//input[@type='number'])[18]", "20" + (i + 1).ToString());
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[2]/td[3]/select"
                                , "label=02 Input status");
                selenium.Type("xpath=(//input[@type='number'])[19]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[20]", "4");
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[2]/td[6]/select"
                                , "label=R/W");
                selenium.Type("xpath=(//input[@type='number'])[21]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[22]", "4");
                selenium.Click("xpath=(//input[@type='checkbox'])[20]");
                PrintStep();

                //rule 03
                selenium.Type("xpath=(//input[@type='number'])[23]", "20" + (i + 2).ToString());
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[3]/td[3]/select"
                                , "label=01 Coil status");
                selenium.Type("xpath=(//input[@type='number'])[24]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[25]", "4");
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[3]/td[6]/select"
                                , "label=R/W");
                selenium.Type("xpath=(//input[@type='number'])[26]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[27]", "8");
                selenium.Click("xpath=(//input[@type='checkbox'])[21]");
                PrintStep();

                //rule 04
                selenium.Type("xpath=(//input[@type='number'])[28]", "20" + (i + 3).ToString());
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[4]/td[3]/select"
                                , "label=02 Input status");
                selenium.Type("xpath=(//input[@type='number'])[29]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[30]", "4");
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[4]/td[6]/select"
                                , "label=R/W");
                selenium.Type("xpath=(//input[@type='number'])[31]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[32]", "12");
                selenium.Click("xpath=(//input[@type='checkbox'])[22]");
                PrintStep();

                //rule 05
                selenium.Type("xpath=(//input[@type='number'])[33]", "20" + (i + 4).ToString());
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[5]/td[3]/select"
                                , "label=03 Holding register");
                selenium.Type("xpath=(//input[@type='number'])[34]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[35]", "4");
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[5]/td[6]/select"
                                , "label=R/W");
                selenium.Type("xpath=(//input[@type='number'])[36]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[37]", "16");
                selenium.Click("xpath=(//input[@type='checkbox'])[23]");
                PrintStep();

                //rule 06
                selenium.Type("xpath=(//input[@type='number'])[38]", "20" + (i + 5).ToString());
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[6]/td[3]/select"
                                , "label=04 Input register");
                selenium.Type("xpath=(//input[@type='number'])[39]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[40]", "4");
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[6]/td[6]/select"
                                , "label=R/W");
                selenium.Type("xpath=(//input[@type='number'])[41]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[42]", "20");
                selenium.Click("xpath=(//input[@type='checkbox'])[24]");
                PrintStep();

                //rule 07
                selenium.Type("xpath=(//input[@type='number'])[43]", "20" + (i + 6).ToString());
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[7]/td[3]/select"
                                , "label=03 Holding register");
                selenium.Type("xpath=(//input[@type='number'])[44]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[45]", "4");
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[7]/td[6]/select"
                                , "label=R/W");
                selenium.Type("xpath=(//input[@type='number'])[46]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[47]", "24");
                selenium.Click("xpath=(//input[@type='checkbox'])[25]");
                PrintStep();

                //rule 08
                selenium.Type("xpath=(//input[@type='number'])[48]", "20" + (i + 7).ToString());
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[8]/td[3]/select"
                                , "label=04 Input register");
                selenium.Type("xpath=(//input[@type='number'])[49]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[50]", "4");
                selenium.Select("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div/table/tbody/tr[8]/td[6]/select"
                                , "label=R/W");
                selenium.Type("xpath=(//input[@type='number'])[51]", "999" + i.ToString());
                selenium.Type("xpath=(//input[@type='number'])[52]", "28");
                selenium.Click("xpath=(//input[@type='checkbox'])[25]");
                PrintStep();

                //
                selenium.Click("//div[@id='TabCom1']/div/div/div/div[2]/div/div[2]/div/div[2]/form/div[2]/button");
            }

            selenium.Close();
        }
        else
        {
            PrintTitle("Module not support.");
        }
    }
Exemplo n.º 17
0
    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++;
        }
    }