Пример #1
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;
            }
        }