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(); }