public void driveFunction(tstObject tstObj, string doFunc, string stpNum, string[] inArray, string baseURL, string datsource, string pth, ref string getNeg, ref string[,] tstresult, out int fndExcep, out int tstFail) { bool dispObj; int failArrLen; string objString; string thsItem; string itmPath; string retXpath; //string tmpString; string[,] vfyArray; string[,] arrOutcome; string tblPath; TimeSpan currTime; WebDriverWait wait; //Function list that corresponds to each sheet on the data sheet. //Array params are passed and the appropriate function is run arrOutcome = null; dispObj = false; tstFail = 0; fndExcep = 0; retXpath = ""; wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); vfyArray = new string[1, 9]; try { switch (doFunc) { #region Login case "Login": { try { //login tstObj.Login(tstObj, inArray, baseURL, stpNum, brwsrType, pth, out fndExcep, ref tstresult); } catch (Exception e) { //Record failed result tmpString = e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region Logout case "Logout": { try { tstObj.Logout(pth, true, stpNum, ref tstresult); } catch (Exception e) { //Record failed result tmpString = e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region addOutcome case "addOutcome": { try { addOutcome(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } catch (NoSuchElementException e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region chkCheckbox case "chkCheckbox": { try { clkLink = inArray[0]; //check to see if the checkbox to be clicked is a modal if (inArray[3] == "Y" || inArray[3] == "y") { driver.SwitchTo().Frame(inArray[4]); do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); //if there is an exception, objString will not be blank //if not blank, fail test and log exception. Otherwise continue execution if (objString == "") { chkCheckbox(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); //TextFileOps.Write(pth, "<br />", clrIndex); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } driver.SwitchTo().DefaultContent(); } else { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); //if there is an exception, objString will not be blank //if not blank, fail test and log exception. Otherwise continue execution if (objString == "") { chkCheckbox(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); //TextFileOps.Write(pth, "<br />", clrIndex); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } } } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region clkButton case "clkButton": { try { clkLink = inArray[0]; Thread.Sleep(1000); //check to see if the button to be clicked is a modal if (inArray[2] == "Y" || inArray[2] == "y") { driver.SwitchTo().Frame(inArray[3]); do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); //if there is an exception, objString will not be blank //if not blank, fail test and log exception. Otherwise continue execution if (objString == "") { tstObj.clkButton(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); //TextFileOps.Write(pth, "<br />", clrIndex); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } driver.SwitchTo().DefaultContent(); } else { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (objString == "") { tstObj.clkButton(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); //TextFileOps.Write(pth, "<br />", clrIndex); } else { fndExcep = -1; failArrLen = tstresult.GetLength(0); throw (new Exception(tstresult[failArrLen - 1, 1])); } } } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region inputText case "inputText": { try { if (inArray[3] == "Y" || inArray[3] == "y") { driver.SwitchTo().Frame(inArray[4]); do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); //if there is an exception, objString will not be blank //if not blank, fail test and log exception. Otherwise continue execution if (objString == "") { tstObj.inputText(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); //TextFileOps.Write(pth, "<br />", clrIndex); } else { fndExcep = -1; } driver.SwitchTo().DefaultContent(); } else { if (inArray[0] != "URL") { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (objString == "") { tstObj.inputText(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); } else { fndExcep = -1; } } } } catch(Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region insertGrades case "insertGrades": { try { wait.Until(drv => driver.FindElement(By.XPath(inArray[0])).Enabled); tstObj.insertGrades(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region navLinks case "navLinks": //navigate to a link { try { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tstObj.navLinks(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); //TextFileOps.Write(pth, "<br />", clrIndex); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region selDropdown case "selDropdown": { try { if (inArray[5] == "Y" || inArray[5] == "y") { driver.SwitchTo().Frame(inArray[6]); do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); //if there is an exception, objString will not be blank //if not blank, fail test and log exception. Otherwise continue execution if (objString == "") { tstObj.selDropDown(tstObj, dispObj, inArray[0], inArray[1], inArray[2], inArray[3], inArray[4], inArray[5], inArray[6], inArray[7], stpNum, pth, ref tstresult, out fndExcep); //TextFileOps.Write(pth, "<br />", clrIndex); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } driver.SwitchTo().DefaultContent(); } else { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); //if there is an exception, objString will not be blank //if not blank, fail test and log exception. Otherwise continue execution if (objString == "") { tstObj.selDropDown(tstObj, dispObj, inArray[0], inArray[1], inArray[2], inArray[3], inArray[4], inArray[5], inArray[6], inArray[7], stpNum, pth, ref tstresult, out fndExcep); //TextFileOps.Write(pth, "<br />", clrIndex); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } } } catch(Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region sendKeys case "sendKeys": tstObj.sendKeys(tstObj, inArray, stpNum, pth, out fndExcep, stpNum); break; #endregion #region tblSelect case "tblSelect": { try { if (inArray[5] == "Y" || inArray[5] == "y") { driver.SwitchTo().Frame(inArray[6]); do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tstObj.tblSelect(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } driver.SwitchTo().DefaultContent(); } else { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tstObj.tblSelect(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } } thsItem = inArray[2]; } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region vfyGrades case "vfyGrades": { try { //add string to the test results list tmpString = "CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); inArray = vfyListArray(inArray); //add string to the test results list tmpString = "Searching for the grades table........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //make sure that item exists do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tmpString = "Found the grade table......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tstObj.vfyGrades(tstObj, dispObj, inArray, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } thsItem = inArray[2]; tmpString = "Finished checking the gradev table"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "END CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "<br />"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region vfyTableEntry case "vfyTableEntry": { try { getNeg = inArray[6]; tmpString = "CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); thsItem = inArray[8]; inArray = vfyListArray(inArray); tmpString = "Searching for the " + inArray[8] + " table........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //wait for the page to load before verification if expecting a table to be present if (inArray[7] == "N") { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, inArray[5]); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (objString == "") { tmpString = "Found the " + thsItem + " table......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); for (int x = 0; x < inArray.Length - 9; x++) { if (dispObj == true) { tstObj.vfyTableEntry(tstObj, inArray[0], inArray[1], inArray[2], inArray[3], inArray[4], inArray[5], inArray[6], inArray[7], inArray[8], inArray[x + 9], datsource, stpNum, pth, ref retXpath, ref tstresult, out fndExcep, out tstFail); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } } } else { fndExcep = -1; objString = ""; tmpString = "The " + thsItem + " item was not found......(Step " + stpNum.ToString() + ")"; tstresult = arrayAppend("True", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tstresult = arrayAppend("True", objString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } } else { tmpString = "Verifying that the " + thsItem + " table is not present"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //TextFileOps.Write(pth, "Found the " + thsItem + " table......", 1); for (int x = 0; x < inArray.Length - 9; x++) { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, inArray[5]); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tstObj.vfyTableEntry(tstObj, inArray[0], inArray[1], inArray[2], inArray[3], inArray[4], inArray[5], inArray[6], inArray[7], inArray[8], inArray[x + 9], datsource, stpNum, pth, ref retXpath, ref tstresult, out fndExcep, out tstFail); } else { fndExcep = -1; TextFileOps.Write(pth, objString, -1); } } } tmpString = "Finished checking the " + thsItem + " item..."; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "END CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion case "vfyTooltip": { try { tblPath = ""; thsItem = inArray[4]; inArray = vfyListArray(inArray); getNeg = inArray[2]; tmpString = "CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "Searching for the tooltip '" + inArray[3] + "'........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //get the table xpath if the tooltip is in a table and/or assign it to tblPath if (inArray[0] != "") vfyTableEntry(tstObj, inArray[0], "/tbody/tr", inArray[2], "Y", "Y", String.Empty, String.Empty, String.Empty, String.Empty, inArray[4], String.Empty, String.Empty, String.Empty, ref tblPath, ref tstresult, out fndExcep, out tstFail); else tblPath = inArray[0]; //verify that the xpath is present do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { vfyTooltip(tstObj, tblPath, ref tstresult, out fndExcep, out tstFail); } else { tmpString = "The " + thsItem + " tooltip was not found......"; tstresult = arrayAppend("True", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); fndExcep = -1; } } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #region vfyDropdown case "vfyDropdown": { try { thsItem = inArray[4]; inArray = vfyListArray(inArray); getNeg = inArray[2]; tmpString = "CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "Searching for the " + inArray[3] + " dropdown........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //wait for the page to load before verification if expecting a table to be present if (inArray[2] != "N" && inArray[2] != "n") { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tmpString = "Found the " + thsItem + " table......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); driver.FindElement(By.XPath(inArray[0])).Click(); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[0] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[1] != "") { itmPath = inArray[0] + "[" + inArray[1] + "]"; } else { itmPath = inArray[0]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " dropdown", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } driver.FindElement(By.XPath(inArray[0])).Click(); } else { tmpString = "The " + thsItem + " dropdown was not found......"; tstresult = arrayAppend("True", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); fndExcep = -1; } } else { for (int x = 0; x < inArray.Length - 4; x++) { tstresult = arrayAppend("verify", "table", dispObj.ToString(), inArray[x + 4], inArray[x + 4], inArray[3], String.Empty, String.Empty, String.Empty, tstresult); if (x > 0) { itmPath = inArray[1] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[2] != "") { itmPath = inArray[1] + "[" + inArray[2] + "]"; } else { itmPath = inArray[1]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " dropdown", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } } tmpString = "Finished checking the " + thsItem + " item..."; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "END CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region vfyButton case "vfyButton": { try { thsItem = inArray[4]; inArray = vfyListArray(inArray); getNeg = inArray[2]; tmpString = "CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "Searching for the " + inArray[2] + " button........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //section off the scenarios if the field is (!=N) or is not (==N) present on the screen if (inArray[2] != "N" && inArray[2] != "n") { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tmpString = "Found the " + thsItem + " button......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //TextFileOps.Write(pth, "Found the " + thsItem + " item......", 1); //driver.FindElement(By.XPath(inArray[0])).Click(); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[0] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[1] != "") { itmPath = inArray[0] + "[" + inArray[1] + "]"; } else { itmPath = inArray[0]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " button", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } } else { tmpString = "The " + thsItem + " button was not found......"; tstresult = arrayAppend("True", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); fndExcep = -1; } } else { tmpString = "Verifying that the " + thsItem + " button is not present"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[1] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[1] != "") { itmPath = inArray[0] + "[" + inArray[1] + "]"; } else { itmPath = inArray[0]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " button", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } } tmpString = "Finished checking the " + thsItem + " button..."; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "END CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region vfyImages case "vfyImages": { try { thsItem = inArray[4]; inArray = vfyListArray(inArray); getNeg = inArray[2]; tmpString = "CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "Searching for the " + inArray[2] + " field........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //section off the scenarios if the field is (!=N) or is not (==N) present on the screen if (inArray[2] != "N" && inArray[2] != "n") { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tmpString = "Found the " + thsItem + " button......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //driver.FindElement(By.XPath(inArray[0])).Click(); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[0] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[1] != "") { itmPath = inArray[0] + "[" + inArray[1] + "]"; } else { itmPath = inArray[0]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " image", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } //driver.FindElement(By.XPath(inArray[0])).Click(); } else { TextFileOps.Write(pth, "The " + thsItem + " image was not found......", -1); fndExcep = -1; } } else { TextFileOps.Write(pth, "Verifying that the " + thsItem + " table is not present", 1); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[0] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[1] != "") { itmPath = inArray[0] + "[" + inArray[1] + "]"; } else { itmPath = inArray[0]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " image", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } } tmpString = "Finished checking the " + thsItem + " image..."; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "END CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = "Failed clicking the dropdown list box: " + e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region vfyField case "vfyField": { try { thsItem = inArray[4]; inArray = vfyListArray(inArray); getNeg = inArray[2]; tmpString = "CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "Searching for the " + inArray[3] + " field........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //section off the scenarios if the field is (!=N) or is not (==N) present on the screen if (inArray[2] != "N" && inArray[2] != "n") { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //driver.FindElement(By.XPath(inArray[0])).Click(); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[0] + "[" + Convert.ToString(x + 1) + "]"; } else { itmPath = inArray[0]; } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " field", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } //driver.FindElement(By.XPath(inArray[0])).Click(); } else { tmpString = "The " + thsItem + " image was not found......"; tstresult = arrayAppend("True", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); fndExcep = -1; } } else { tmpString = "Verifying that the " + thsItem + " table is not present"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[0] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[2] != "") { itmPath = inArray[1] + "[" + inArray[2] + "]"; } else { itmPath = inArray[1]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " field", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } } tmpString = "Finished checking the " + thsItem + " field..."; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "END CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region vfyOutcome case "vfyOutcome": { try { thsItem = ""; inArray = vfyListArray(inArray); tmpString = "CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "Checking the student for scores ........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { //driver.FindElement(By.XPath(inArray[0])).Click(); for (int x = 0; x < inArray.Length - 9; x++) { thsItem = inArray[x + 9]; tmpString = "Searching for " + thsItem + "'s scores"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "Found " + thsItem + "'s row in the score table......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); if (x > 0) { itmPath = inArray[0] + "[" + Convert.ToString(x + 1) + "]"; } else { itmPath = inArray[0]; } tstObj.vfyOutcome(tstObj, inArray[0], inArray, inArray[x + 9], dispObj, stpNum, pth, ref arrOutcome, ref tstresult, out fndExcep, out tstFail); tmpString = "Finished checking the " + thsItem + " field..."; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "<br />"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } for (int a = 0; a < arrOutcome.GetLength(0); a++) { tstresult = arrayAppend("verify", "weight", arrOutcome[a, 0], arrOutcome[a, 1], String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } } else { tmpString = "The " + thsItem + " image was not found......"; tstresult = arrayAppend("True", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); fndExcep = -1; } tmpString = "END CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region vfyText case "vfyText": { try { thsItem = inArray[4]; inArray = vfyListArray(inArray); getNeg = inArray[2]; tmpString = "CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "Searching for the " + inArray[2] + " text........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //section off the scenarios if the field is (!=N) or is not (==N) present on the screen if (inArray[1] != "N" && inArray[1] != "n") { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, ""); if (currTime.Seconds >= 10) { dispObj = false; break; } } while (dispObj != true); if (dispObj == true) { tmpString = "Found the " + thsItem + " text......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[0] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[1] != "") { itmPath = inArray[0] + "[" + inArray[1] + "]"; } else { itmPath = inArray[0]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " text", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } } else { tmpString = "The " + thsItem + " text was not found......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); fndExcep = -1; } } else { tmpString = "Verifying that the " + thsItem + " text is not present"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } tmpString = "Finished checking the " + thsItem + " text..."; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "END CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region vfyLink case "vfyLink": { try { thsItem = inArray[4]; inArray = vfyListArray(inArray); getNeg = inArray[2]; tmpString = "CHECKPOINT:"; tstresult = arrayAppend(dispObj.ToString(), tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "Searching for the " + inArray[2] + " button........(" + stpNum + ")"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //TextFileOps.Write(pth, "CHECKPOINT:", 20); //Recorder.vfyNav(true, thsItem, " field", stpNum, pth); //section off the scenarios if the field is (!=N) or is not (==N) present on the screen if (inArray[1] != "N" && inArray[1] != "n") { do { dispObj = WaitUntil(inArray[0], out objString, out currTime, inArray[3]); } while (dispObj != true); if (dispObj == true) { tmpString = "Found the " + thsItem + " link......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); driver.FindElement(By.XPath(inArray[0])).Click(); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[1] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[2] != "") { itmPath = inArray[1] + "[" + inArray[2] + "]"; } else { itmPath = inArray[1]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " link", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } driver.FindElement(By.XPath(inArray[0])).Click(); } else { tmpString = "The " + thsItem + " link was not found......"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); fndExcep = -1; } } else { tmpString = "Verifying that the " + thsItem + " link is not present"; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); for (int x = 0; x < inArray.Length - 4; x++) { if (x > 0) { itmPath = inArray[1] + "[" + Convert.ToString(x + 1) + "]"; } else { if (inArray[2] != "") { itmPath = inArray[1] + "[" + inArray[2] + "]"; } else { itmPath = inArray[1]; } } tstObj.vfyObject(tstObj, itmPath, inArray[1], inArray[2], inArray[3], inArray[x + 4], " link", dispObj, stpNum, pth, ref tstresult, out fndExcep, out tstFail); } } tmpString = "Finished checking the " + thsItem + " text..."; tstresult = arrayAppend("True", tmpString, "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); tmpString = "END CHECKPOINT:"; tstresult = arrayAppend("True", tmpString, "20", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region Wait case "Wait": { try { tstObj.Wait(inArray[0]); tstresult = arrayAppend("True", "Waiting " + inArray[0] + " seconds........(" + stpNum + ")", "80", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); } catch (Exception e) { //Record failed result tmpString = e.Message; tstresult = arrayAppend("False", tmpString, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); //Record exception and begin exit process fndExcep = -1; } break; } #endregion #region default default: fndExcep = -1; TextFileOps.Write(pth, "Step (" + stpNum + "), " + doFunc + " is not present in the testing app", -1); break; #endregion } } catch (Exception e) { tstresult = arrayAppend("False", e.Message, "-1", String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, tstresult); fndExcep = -1; } }