public void Execute(Arguments arguments)
        {
            int       timeout   = (int)arguments.Timeout.Value.TotalMilliseconds;
            int       start     = Environment.TickCount;
            string    result    = string.Empty;
            IEWrapper ieWrapper = IEManager.CurrentIE;

            while (Math.Abs(Environment.TickCount - start) < timeout &&
                   Scripter.Stopped == false &&
                   result.ToLower() != arguments.ExpectedValue?.Value?.ToLower())
            {
                try
                {
                    result = ieWrapper.InsertJavaScriptAndTakeResult(arguments.Script.Value) ?? string.Empty;
                }
                catch
                {
                    // JavaScript exception occured but we don't really care
                    // maybe element did not exist and we got exception cause of that
                }
                Application.DoEvents();
            }
            if (result.ToLower() != arguments.ExpectedValue.Value?.ToLower())
            {
                throw new TimeoutException("Timeout occured while waiting for an element. Specified element was not found.");
            }
        }
 public void Execute(Arguments arguments)
 {
     try
     {
         IEWrapper ie     = IEManager.CurrentIE;
         string    result = ie.InsertJavaScriptAndTakeResult(arguments.Script.Value);
         Scripter.Variables.SetVariableValue(arguments.Result.Value, new TextStructure(result));
     }
     catch (Exception ex)
     {
         throw new ApplicationException($"Problem occured while trying to run javascript code. Message: {ex.Message}", ex);
     }
 }