public static void KeyPress(String obj, String data)
        {
            Log.Info("KeyPress " + data + " on .. " + obj);
            ExtentReporter.NodeInfo("KeyPress " + data + " on .. " + obj);
            try
            {
                string[] locator = obj.Split('_');
                switch (data.ToLower().Trim())
                {
                case "enter":
                    driver.FindElement(LocateValue(locator[1], GetKey(obj))).SendKeys(Keys.Enter);
                    break;

                case "return":
                    driver.FindElement(LocateValue(locator[1], GetKey(obj))).SendKeys(Keys.Return);
                    break;

                case "tab":
                    driver.FindElement(LocateValue(locator[1], GetKey(obj))).SendKeys(Keys.Tab);
                    break;

                default:
                    Log.Error("Not a key");
                    break;
                }
            }
            catch (Exception e)
            {
                Log.Error("Not able to KeyPress " + data + " | Exception: " + e.Message);
                ExtentReporter.NodeError("Not able to KeyPress " + data + " | Exception: " + e.Message);
                DriverScript.iOutcome = 3;
            }
        }
Example #2
0
        private static void Execute_Actions()
        {
            for (int i = 0; i < method.Length; i++)
            {
                if (method[i].Name.Equals(sActionKeyword))
                {
                    method[i].Invoke(actionKeywords, new object[] { sPageObject, sData });

                    if (iOutcome == 1)
                    {
                        ExcelUtils.SetCellData(Outcome.Pass.ToString(), iTestStep, Constants.Col_TestStepResult, Constants.Sheet_TestSteps);
                        ExtentReporter.Pass(sTestStepDesc);
                        break;
                    }
                    else if (iOutcome == 2)
                    {
                        ExcelUtils.SetCellData(Outcome.Fail.ToString(), iTestStep, Constants.Col_TestStepResult, Constants.Sheet_TestSteps);
                        ExtentReporter.Fail(sTestStepDesc);
                        //ActionKeywords.CloseBrowser("", "");
                        break;
                    }
                    else if (iOutcome == 3)
                    {
                        ExcelUtils.SetCellData(Outcome.Error.ToString(), iTestStep, Constants.Col_TestStepResult, Constants.Sheet_TestSteps);
                        ExtentReporter.Error(sTestStepDesc);
                        //ActionKeywords.CloseBrowser("", "");
                        break;
                    }
                }
            }
        }
        public static void AssertElementContains(String obj, String data)
        {
            Log.Info("AssertElementContains .. " + obj);
            ExtentReporter.NodeInfo("AssertElementContains .. " + obj);
            try
            {
                string[] locator = obj.Split('_');
                By       by      = LocateValue(locator[1], GetKey(obj));

                //WaitForInvisibilityLoading(out double loadtime);
                //Log.Info("Loadtime: " + loadtime);

                //ScrollIntoView(by);
                WaitUntil(by, driver);

                Assert.AreEqual(GetTextByDriver(by), data);
                WaitSeconds("", "2");
                DriverScript.iOutcome = 1;
            }
            catch (AssertFailedException e)
            {
                Log.Error("AssertElementContains Assert Fail| Exception: " + e.Message);
                ExtentReporter.NodeFail("AssertElementContains Assert Fail| Exception: " + e.Message);
                DriverScript.iOutcome = 2;
            }
            catch (Exception e)
            {
                Log.Error("Failed AssertElementContains | Exception: " + e.Message);
                ExtentReporter.NodeError("Failed AssertElementContains | Exception: " + e.Message);
                DriverScript.iOutcome = 3;
            }
        }
Example #4
0
        public static void NavigateToURL(String obj, String data)
        {
            try
            {
                Log.Info($"Navigating to URL {data}");
                ExtentReporter.NodeInfo($"Navigating to URL {data}");

                ((IJavaScriptExecutor)driver).ExecuteScript("return window.stop;");

                string currentURL = driver.Url;
                if (!currentURL.Equals(data))
                {
                    driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(Constants.NavigationTimeout);
                    driver.Url = data;
                    //driver.Navigate().GoToUrl(data);
                }
                else
                {
                    driver.Navigate().Refresh();
                }
            }
            catch (Exception e)
            {
                Log.Error("Not able to navigate to URL | Exception: " + e.Message);
                ExtentReporter.NodeInfo("Not able to navigate to URL | Exception: " + e.Message);
                DriverScript.iOutcome = 3;
            }
        }
Example #5
0
        public static void OpenMobileApp(String obj, String data)
        {
            Log.Info("Opening App");
            ExtentReporter.NodeInfo("Opening App");

            try
            {
                if (data.Equals(OS.Android.ToString()))
                {
                    OpenAndroidDriver(Constants.DeviceName, Constants.Udid, Constants.PlatformVersion, Constants.AndroidAppapk);
                }
                else if (data.Equals(OS.IOS.ToString()))
                {
                    //IOS
                }

                Log.Info("App Opened");
                ExtentReporter.NodeInfo("App Opened");
            }
            catch (Exception e)
            {
                Log.Error($"Failed OpenApp | Exception: {e.Message}");
                ExtentReporter.NodeError($"Failed OpenApp | Exception: {e.Message}");
                DriverScript.iOutcome = 3;
            }
        }
Example #6
0
        private void Execute_TestCase()
        {
            int iTotalTestCases = ExcelUtils.GetRowCount(Constants.Sheet_TestCases);

            for (int iTestcase = 1; iTestcase < iTotalTestCases; iTestcase++)
            {
                iOutcome       = 1;
                sTestCaseID    = ExcelUtils.GetCellData(iTestcase, Constants.Col_ID, Constants.Sheet_TestCases);
                sTestCaseTitle = ExcelUtils.GetCellData(iTestcase, Constants.Col_Title, Constants.Sheet_TestCases);
                sTestCaseDesc  = ExcelUtils.GetCellData(iTestcase, Constants.Col_Description, Constants.Sheet_TestCases);
                sRunMode       = ExcelUtils.GetCellData(iTestcase, Constants.Col_RunMode, Constants.Sheet_TestCases);

                if (sRunMode.Equals("Yes"))
                {
                    Log.StartTestCase(sTestCaseID);
                    ExtentReporter.CreateTest(sTestCaseID + "_" + sTestCaseTitle, sTestCaseDesc);
                    ExtentReporter.StartTestCase(sTestCaseID + "_" + sTestCaseTitle);
                    iTestStep     = ExcelUtils.GetRowContains(sTestCaseID, Constants.Col_TestCaseID, Constants.Sheet_TestSteps);
                    iTestLastStep = ExcelUtils.GetTestStepsCount(Constants.Sheet_TestSteps, sTestCaseID, iTestStep);
                    iOutcome      = 1;
                    for (; iTestStep < iTestLastStep; iTestStep++)
                    {
                        sActionKeyword = ExcelUtils.GetCellData(iTestStep, Constants.Col_ActionKeyword, Constants.Sheet_TestSteps);
                        sPageObject    = ExcelUtils.GetCellData(iTestStep, Constants.Col_PageObject, Constants.Sheet_TestSteps);
                        sData          = ExcelUtils.GetCellData(iTestStep, Constants.Col_DataSet, Constants.Sheet_TestSteps);
                        sTestStepDesc  = ExcelUtils.GetCellData(iTestStep, Constants.Col_TestStepDesc, Constants.Sheet_TestSteps);
                        ExtentReporter.CreateNode(sTestStepDesc);
                        Execute_Actions();

                        if (iOutcome == 3)
                        {
                            ExcelUtils.SetCellData(Outcome.Error.ToString(), iTestcase, Constants.Col_Result, Constants.Sheet_TestCases);
                            Log.EndTestCase(sTestCaseID);
                            ExtentReporter.Error("TestCase " + sTestCaseID + "_" + sTestCaseTitle + " Error");
                            ExtentReporter.EndTestCase(sTestCaseID + "_" + sTestCaseTitle);
                            Assert.Fail();
                            break;
                        }
                    }

                    if (iOutcome == 1)
                    {
                        ExcelUtils.SetCellData(Outcome.Pass.ToString(), iTestcase, Constants.Col_Result, Constants.Sheet_TestCases);
                        Log.EndTestCase(sTestCaseID);
                        ExtentReporter.Pass("TestCase " + sTestCaseID + "_" + sTestCaseTitle + " Passed");
                        ExtentReporter.EndTestCase(sTestCaseID + "_" + sTestCaseTitle);
                    }
                    else if (iOutcome == 2)
                    {
                        ExcelUtils.SetCellData(Outcome.Fail.ToString(), iTestcase, Constants.Col_Result, Constants.Sheet_TestCases);
                        Log.EndTestCase(sTestCaseID);
                        ExtentReporter.Fail("TestCase " + sTestCaseID + "_" + sTestCaseTitle + " Failed");
                        ExtentReporter.EndTestCase(sTestCaseID + "_" + sTestCaseTitle);
                    }
                }
            }
        }
        public static void DragDropTrad(String obj, String data)
        {
            Log.Info("Draging Webelement " + obj);
            ExtentReporter.NodeInfo("Draging Webelement " + obj);
            try
            {
                string[] locator1      = obj.Split('_');
                string[] locator2value = data.Split('_');

                By byDragElement = LocateValue(locator1[1], GetKey(obj));
                By byDropValue   = LocateValue(locator2value[1], GetKey(data));

                IWebElement source;
                IWebElement target;

                //WaitForInvisibilityLoading(out double loadtime);
                //Log.Info("Loadtime: " + loadtime);

                WaitUntilExists(byDragElement, driver);
                if (IsElementPresent(byDragElement))
                {
                    source = driver.FindElement(byDragElement);
                }
                else
                {
                    WaitForElement(byDragElement);
                    source = driver.FindElement(byDragElement);
                }

                WaitUntilExists(byDropValue, driver);
                if (IsElementPresent(byDragElement))
                {
                    target = driver.FindElement(byDropValue);
                }
                else
                {
                    WaitForElement(byDragElement);
                    target = driver.FindElement(byDropValue);
                }

                IJavaScriptExecutor jse = (IJavaScriptExecutor)driver;
                if (File.Exists(Constants.Drag_Drop))
                {
                    WaitSeconds("", "3");
                    string dragAndDropScript = File.ReadAllText(Constants.Drag_Drop);
                    jse.ExecuteScript(dragAndDropScript, source, target);
                    WaitSeconds("", "3");
                }
            }
            catch (Exception e)
            {
                Log.Error("Not able to drag and drop | Exception: " + e.Message);
                ExtentReporter.NodeError("Not able to drag and drop | Exception: " + e.Message);
                DriverScript.iOutcome = 3;
            }
        }
Example #8
0
        public static void DisposeFeatureWebDriver(FeatureContext featureContext)
        {
            var testContext = featureContext.FeatureContainer.Resolve <UITestContext>();
            var driver      = testContext.Driver;

            driver.Quit();

            if (_reporter == null)
            {
                _reporter = testContext.Reporter;
            }
        }
        public static void AssertTaskcompleted(String obj, String data)
        {
            Log.Info("AssertTaskcompleted .. " + obj);
            ExtentReporter.NodeInfo("AssertTaskcompleted .. " + obj);
            try
            {
                string[] locator = obj.Split('_');


                string newcompleteddata;
                string newprogressddata;

                newcompleteddata = GetKey(obj).Replace("#1", DateTime.Today.Date.ToString("dd/MM/yyyy")).Replace("#2", DateTime.Today.Date.ToString("مكتملة"));
                newprogressddata = GetKey(obj).Replace("#1", DateTime.Today.Date.ToString("dd/MM/yyyy")).Replace("#2", DateTime.Today.Date.ToString("جاري"));


                By bycompleteddata = LocateValue(locator[1], newcompleteddata);
                By byprogressddata = LocateValue(locator[1], newprogressddata);

                ExtentReporter.NodeInfo($"completed .. {newcompleteddata}|{bycompleteddata}");

                ExtentReporter.NodeInfo($"inprogress .. {newprogressddata}|{byprogressddata}");

                if (IsElementPresent(bycompleteddata))
                {
                    WaitSeconds("", "2");
                    DriverScript.iOutcome = 1;
                }
                else if (IsElementPresent(byprogressddata))
                {
                    Assert.Fail();
                }
                else
                {
                    ExtentReporter.NodeInfo("nothing .. ");
                    Assert.Fail();
                }
            }
            catch (AssertFailedException e)
            {
                Log.Error("AssertTaskcompleted Assert Fail| Exception: " + e.Message);
                ExtentReporter.NodeFail("AssertTaskcompleted Assert Fail| Exception: " + e.Message);
                DriverScript.iOutcome = 2;
            }
            catch (Exception e)
            {
                Log.Error("Failed AssertTaskcompleted | Exception: " + e.Message);
                ExtentReporter.NodeError("Failed AssertTaskcompleted | Exception: " + e.Message);
                DriverScript.iOutcome = 3;
            }
        }
Example #10
0
        public void SetupReporting()
        {
            if (htmlReporter == null)
            {
                htmlReporter = ExtentReporter.getHtmlReport();
                extent       = new ExtentReports();
                extent.AttachReporter(htmlReporter);
            }

            if (runID == null || runID == "")
            {
                runID = createTestRun(projectID);
            }
        }
Example #11
0
 private static bool IsElementPresent(By by)
 {
     try
     {
         driver.FindElement(by);
         return(true);
     }
     catch (NoSuchElementException e)
     {
         Log.Info($"No able to find element by IsElementPresent | Exception: {e.Message}");
         ExtentReporter.NodeInfo($"No able to find element by IsElementPresent | Exception: {e.Message}");
         return(false);
     }
 }
Example #12
0
 private static void WaitUntilClickable(By by, IWebDriver driver)
 {
     try
     {
         Log.Info("WaitUntilClickable ..");
         WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(Constants.Timeout));
         wait.Until(ExpectedConditions.ElementToBeClickable(by));
     }
     catch (Exception e)
     {
         Log.Error("Failed WaitUntilClickable | Exception: " + e.Message);
         ExtentReporter.NodeInfo("Failed WaitUntil | Exception: " + e.Message);
     }
 }
Example #13
0
 private static void WaitUntilInvisibilityElement(By by)
 {
     try
     {
         Log.Info("WaitUntilInvisibilityElement ..");
         ExtentReporter.NodeInfo("WaitUntilInvisibilityElement ..");
         WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(Constants.NavigationTimeout));
         wait.Until(ExpectedConditions.InvisibilityOfElementLocated(by));
     }
     catch (Exception e)
     {
         Log.Error("Failed WaitUntilInvisibilityElement | Exception: " + e.Message);
         ExtentReporter.NodeError("Failed WaitUntilInvisibilityElement | Exception: " + e.Message);
     }
 }
Example #14
0
        private static void WaitUntil(By by, IWebDriver driver)
        {
            try
            {
                Log.Info("WaitUntil ..");
                ExtentReporter.NodeInfo("WaitUntil ..");

                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(Constants.Timeout));
                wait.Until(d => d.FindElement(by));
            }
            catch (Exception e)
            {
                Log.Error("Failed WaitUntil | Exception: " + e.Message);
            }
        }
Example #15
0
 private static void WaitUntilUrlContains(String data)
 {
     try
     {
         Log.Info("WaitUntilUrlContains .." + data);
         ExtentReporter.NodeInfo("WaitUntilUrlContains ..");
         WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(Constants.NavigationTimeout));
         wait.Until(ExpectedConditions.UrlContains(data));
     }
     catch (Exception e)
     {
         Log.Error("Failed WaitUntilUrlContains | Exception: " + e.Message);
         ExtentReporter.NodeError("Failed WaitUntilUrlContains | Exception: " + e.Message);
     }
 }
Example #16
0
        public static void RefreshBrowser(String obj, String data)
        {
            try
            {
                Log.Info($"Refreshing Browser");
                ExtentReporter.NodeInfo($"Refreshing Browser");

                driver.Navigate().Refresh();
            }
            catch (Exception e)
            {
                Log.Error($"Failed RefreshBrowser | Exception: {e.Message}");
                ExtentReporter.NodeInfo($"Failed RefreshBrowser | Exception: {e.Message}");
                DriverScript.iOutcome = 3;
            }
        }
Example #17
0
        private static void ScrollIntoView(By by)
        {
            try
            {
                Log.Info("ScrollIntoView ..");
                ExtentReporter.NodeInfo("ScrollIntoView ..");

                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                js.ExecuteScript("arguments[0].scrollIntoView(true);", driver.FindElement(by));
            }
            catch (Exception e)
            {
                Log.Info($"Not able to ScrollIntoView | Exception: {e.Message}");
                ExtentReporter.NodeInfo($"Not able to ScrollIntoView | Exception: {e.Message}");
            }
        }
Example #18
0
        private static bool ClickByDriver(IWebElement element)
        {
            try
            {
                Log.Info("ClickByDriver ..");
                ExtentReporter.NodeInfo("ClickByDriver ..");

                element.Click();
                return(true);
            }
            catch (Exception e)
            {
                Log.Info($"Not able to ClickByDriver | Exception: {e.Message}");
                ExtentReporter.NodeInfo($"Not able to ClickByDriver | Exception: {e.Message}");
                return(false);
            }
        }
Example #19
0
        public static void Click(String obj, String data)
        {
            Log.Info($"Clicking on Element {obj}");
            ExtentReporter.NodeInfo($"Clicking on Element {obj}");

            try
            {
                string[] locator = obj.Split('_');
                By       by      = LocateValue(locator[1], GetKey(obj));

                if (locator[0] == "Mobile")
                {
                    WaitUntilVisible(by, appiumdriver);
                    WaitSeconds("", "2");

                    if (!ClickByappiumDriver(by))
                    {
                        Log.Error("Failed ClickByappiumDriver");
                        ExtentReporter.NodeError("Failed ClickByappiumDriver");
                        DriverScript.iOutcome = 3;
                    }
                }
                else
                {
                    WaitUntilClickable(by, driver);
                    WaitSeconds("", "2");

                    if (!ClickByDriver(by))
                    {
                        if (!ClickByJavascript(by))
                        {
                            Log.Error("Failed ClickByDriver and ClickByJavascript");
                            ExtentReporter.NodeError("Failed ClickByDriver and ClickByJavascript");
                            DriverScript.iOutcome = 3;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error($"Failed Click | Exception: {e.Message}");
                ExtentReporter.NodeError($"Failed Click | Exception: {e.Message}");
                ExtentReporter.AddScreenShot("");
                DriverScript.iOutcome = 3;
            }
        }
Example #20
0
        private static bool ClearByDriver(By by, String data)
        {
            try
            {
                Log.Info("ClearByDriver ..");
                ExtentReporter.NodeInfo("ClearByDriver ..");

                driver.FindElement(by).Clear();
                return(true);
            }
            catch (Exception e)
            {
                Log.Info($"Not able to ClearByDriver | Exception: {e.Message}");
                ExtentReporter.NodeInfo($"Not able to ClearByDriver | Exception: {e.Message}");
                return(false);
            }
        }
Example #21
0
        private static bool InputByappiumDriver(By by, String data)
        {
            try
            {
                Log.Info("InputByappiumDriver ..");
                ExtentReporter.NodeInfo("InputByappiumDriver ..");

                appiumdriver.FindElement(by).SendKeys(data);
                return(true);
            }
            catch (Exception e)
            {
                Log.Info($"Not able to InputByappiumDriver | Exception: {e.Message}");
                ExtentReporter.NodeInfo($"Not able to InputByappiumDriver | Exception: {e.Message}");
                return(false);
            }
        }
Example #22
0
        private static bool ClickByappiumDriver(By by)
        {
            try
            {
                Log.Info("ClickByappiumDriver ..");
                ExtentReporter.NodeInfo("ClickByappiumDriver ..");

                appiumdriver.FindElement(by).Click();
                return(true);
            }
            catch (Exception e)
            {
                Log.Info($"Not able to ClickByappiumDriver | Exception: {e.Message}");
                ExtentReporter.NodeInfo($"Not able to ClickByappiumDriver | Exception: {e.Message}");
                return(false);
            }
        }
Example #23
0
        private static bool SelectValueByappiumDriver(By by, string data)
        {
            try
            {
                Log.Info("SelectValueByappiumDriver ..");
                ExtentReporter.NodeInfo("SelectValueByappiumDriver ..");

                new SelectElement(appiumdriver.FindElement(by)).SelectByValue(data);
                return(true);
            }
            catch (Exception e)
            {
                Log.Info($"Not able to SelectValueByappiumDriver | Exception: {e.Message}");
                ExtentReporter.NodeInfo($"Not able to SelectValueByappiumDriver | Exception: {e.Message}");
                return(false);
            }
        }
Example #24
0
        public static void WaitSeconds(String obj, String data)
        {
            try
            {
                int millisec = Convert.ToInt32(data) * 1000;
                Log.Info($"Waiting {data} seconds");
                ExtentReporter.NodeInfo($"Waiting {data} seconds");

                Thread.Sleep(millisec);
            }
            catch (Exception e)
            {
                Log.Error($"Failed WaitSeconds | Exception: {e.Message}");
                ExtentReporter.NodeInfo($"Failed WaitSeconds | Exception: {e.Message}");
                DriverScript.iOutcome = 3;
            }
        }
Example #25
0
        public static void OpenBrowser(String obj, String data)
        {
            Log.Info($"Opening Browser {data}");
            ExtentReporter.NodeInfo($"Opening Browser {data}");
            try
            {
                driver = BuildDriver(Constants.DriverType, data);

                Log.Info($"Browser {data} Opened");
                ExtentReporter.NodeInfo($"Browser {data} Opened");
            }
            catch (Exception e)
            {
                Log.Error($"Failed OpenBrowser | Exception: {e.Message}");
                ExtentReporter.NodeError($"Failed OpenBrowser | Exception: {e.Message}");
                DriverScript.iOutcome = 3;
            }
        }
Example #26
0
        private static bool InputByJavascript(By by, String data)
        {
            try
            {
                Log.Info("InputByJavascript ..");
                ExtentReporter.NodeInfo("InputByJavascript ..");

                IJavaScriptExecutor jse = (IJavaScriptExecutor)driver;
                jse.ExecuteScript("arguments[0].value='" + data + "';", driver.FindElement(by));
                return(true);
            }
            catch (Exception e)
            {
                Log.Info($"Not able to InputByJavascript | Exception: { e.Message}");
                ExtentReporter.NodeInfo($"Not able to InputByJavascript | Exception: {e.Message}");
                return(false);
            }
        }
Example #27
0
        private static bool ClickByJavascript(IWebElement element)
        {
            try
            {
                Log.Info("ClickByJavascript ..");
                ExtentReporter.NodeInfo("ClickByJavascript ..");

                IJavaScriptExecutor jse = (IJavaScriptExecutor)driver;
                jse.ExecuteScript("arguments[arguments.length - 1].click();", element);
                return(true);
            }
            catch (Exception e)
            {
                Log.Info($"Not able to ClickByJavascript | Exception: {e.Message}");
                ExtentReporter.NodeInfo($"Not able to ClickByJavascript | Exception: {e.Message}");
                return(false);
            }
        }
Example #28
0
        public static void Select(String obj, String data)
        {
            Log.Info($"Selecting from dropdown Element {obj}");
            ExtentReporter.NodeInfo($"Selecting from dropdown Element {obj}");

            try
            {
                string[] locator = obj.Split('_');
                By       by      = LocateValue(locator[1], GetKey(obj));

                if (locator[0] == "Mobile")
                {
                    WaitUntil(by, appiumdriver);
                    if (!SelectTextByappiumDriver(by, data))
                    {
                        if (!SelectValueByappiumDriver(by, data))
                        {
                            Log.Error("Failed SelectTextByappiumDriver and SelectValueByappiumDriver");
                            ExtentReporter.NodeError("Failed SelectTextByappiumDriver and SelectValueByappiumDriver");
                            DriverScript.iOutcome = 3;
                        }
                    }
                }
                else
                {
                    WaitUntil(by, driver);
                    if (!SelectTextByDriver(by, data))
                    {
                        if (!SelectValueByDriver(by, data))
                        {
                            Log.Error("Failed SelectTextByDriver and SelectValueByDriver");
                            ExtentReporter.NodeError("Failed SelectTextByDriver and SelectValueByDriver");
                            DriverScript.iOutcome = 3;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error($"Failed Select | Exception: {e.Message}");
                ExtentReporter.NodeError($"Failed Select | Exception: {e.Message}");
                DriverScript.iOutcome = 3;
            }
        }
Example #29
0
        private static void WaitFluentUntil(By by)
        {
            try
            {
                Log.Info("WaitFluentUntil ..");
                ExtentReporter.NodeInfo("WaitFluentUntil ..");

                DefaultWait <IWebDriver> fluentWait = new DefaultWait <IWebDriver>(driver);
                fluentWait.Timeout         = TimeSpan.FromSeconds(Constants.Timeout);
                fluentWait.PollingInterval = TimeSpan.FromSeconds(1);
                fluentWait.IgnoreExceptionTypes(typeof(NoSuchElementException));
                IWebElement searchResult = fluentWait.Until(x => x.FindElement(by));
            }
            catch (Exception e)
            {
                Log.Error("Failed WaitFluentUntil | Exception: " + e.Message);
                ExtentReporter.NodeError("Failed WaitFluentUntil | Exception: " + e.Message);
            }
        }
Example #30
0
        public static void CloseMobileApp(String obj, String data)
        {
            try
            {
                Log.Info("Closing App");
                ExtentReporter.NodeInfo("Closing App");

                appiumdriver.Quit();

                Log.Info("App Closed");
                ExtentReporter.NodeInfo("App Closed");
            }
            catch (Exception e)
            {
                Log.Error($"Failed CloseApp | Exception: {e.Message}");
                ExtentReporter.NodeError($"Failed CloseApp | Exception: {e.Message}");
                DriverScript.iOutcome = 3;
            }
        }