public override void RunCommand(object sender)
        {
            var engine = (AutomationEngineInstance)sender;

            var browserObject   = v_InstanceName.GetAppInstance(engine);
            var browserInstance = (InternetExplorer)browserObject;

            browserInstance.Navigate(v_URL.ConvertUserVariableToString(engine));
            IECreateBrowserCommand.WaitForReadyState(browserInstance);
        }
        public async override Task RunCommand(object sender)
        {
            var engine = (IAutomationEngineInstance)sender;

            var browserObject   = ((OBAppInstance)await v_InstanceName.EvaluateCode(engine)).Value;
            var browserInstance = (InternetExplorer)browserObject;

            browserInstance.Navigate((string)await v_URL.EvaluateCode(engine));
            IECreateBrowserCommand.WaitForReadyState(browserInstance);
        }
        private async Task RunCommandActions(IHTMLElement element, object sender, InternetExplorer browserInstance)
        {
            var engine = (IAutomationEngineInstance)sender;

            switch (v_WebAction)
            {
            case "Fire onmousedown event":
                ((IHTMLElement3)element).FireEvent("onmousedown");
                break;

            case "Fire onmouseover event":
                ((IHTMLElement3)element).FireEvent("onmouseover");
                break;

            case "Invoke Click":
                element.click();
                IECreateBrowserCommand.WaitForReadyState(browserInstance);
                break;

            case "Left Click":
            case "Middle Click":
            case "Right Click":
                int elementXposition = FindElementXPosition(element);
                int elementYposition = FindElementYPosition(element);

                //inputs need to be validated

                string userXAdjustString = (from rw in v_WebActionParameterTable.AsEnumerable()
                                            where rw.Field <string>("Parameter Name") == "X Adjustment"
                                            select rw.Field <string>("Parameter Value")).FirstOrDefault();
                int userXAdjust = (int)await userXAdjustString.EvaluateCode(engine);

                string userYAdjustString = (from rw in v_WebActionParameterTable.AsEnumerable()
                                            where rw.Field <string>("Parameter Name") == "Y Adjustment"
                                            select rw.Field <string>("Parameter Value")).FirstOrDefault();
                int userYAdjust = (int)await userYAdjustString.EvaluateCode(engine);

                var ieClientLocation = User32Functions.GetWindowPosition(new IntPtr(browserInstance.HWND));

                var mouseX     = (elementXposition + ieClientLocation.left + 10) + userXAdjust;                                  // + 10 gives extra padding
                var mouseY     = (elementYposition + ieClientLocation.top + 90 + SystemInformation.CaptionHeight) + userYAdjust; // +90 accounts for title bar height
                var mouseClick = v_WebAction;

                User32Functions.SendMouseMove(mouseX, mouseY, v_WebAction);
                break;

            case "Set Attribute":
                string setAttributeName = (from rw in v_WebActionParameterTable.AsEnumerable()
                                           where rw.Field <string>("Parameter Name") == "Attribute Name"
                                           select rw.Field <string>("Parameter Value")).FirstOrDefault();

                string valueToSet = (from rw in v_WebActionParameterTable.AsEnumerable()
                                     where rw.Field <string>("Parameter Name") == "Value To Set"
                                     select rw.Field <string>("Parameter Value")).FirstOrDefault();

                valueToSet = (string)await valueToSet.EvaluateCode(engine);

                element.setAttribute(setAttributeName, valueToSet);
                break;

            case "Set Text":
                string setTextAttributeName = "value";

                string textToSet = (from rw in v_WebActionParameterTable.AsEnumerable()
                                    where rw.Field <string>("Parameter Name") == "Text To Set"
                                    select rw.Field <string>("Parameter Value")).FirstOrDefault();

                textToSet = (string)await textToSet.EvaluateCode(engine);

                element.setAttribute(setTextAttributeName, textToSet);
                break;

            case "Get Attribute":
                string attributeName = (from rw in v_WebActionParameterTable.AsEnumerable()
                                        where rw.Field <string>("Parameter Name") == "Attribute Name"
                                        select rw.Field <string>("Parameter Value")).FirstOrDefault();

                string variableName = (from rw in v_WebActionParameterTable.AsEnumerable()
                                       where rw.Field <string>("Parameter Name") == "Variable Name"
                                       select rw.Field <string>("Parameter Value")).FirstOrDefault();

                string convertedAttribute = Convert.ToString(element.getAttribute(attributeName));

                convertedAttribute.SetVariableValue(engine, variableName);
                break;
            }
        }