public void Execute(Arguments arguments)
 {
     try
     {
         IEWrapper ie    = IEManager.CurrentIE;
         string    value = ie.GetAttribute(arguments.Name.Value,
                                           arguments.Search.Value,
                                           arguments.By.Value,
                                           (int)arguments.Timeout.Value.TotalMilliseconds,
                                           arguments.NoWait.Value);
         Scripter.Variables.SetVariableValue(arguments.Result.Value, new TextStructure(value));
     }
     catch (Exception ex)
     {
         throw new ApplicationException($"Error occured while getting attribute '{arguments.Name.Value}' value. Message: {ex.Message}", ex);
     }
 }
 public void Execute(Arguments arguments)
 {
     try
     {
         IEWrapper ie = IEManager.CurrentIE;
         if (arguments.NoWait.Value)
         {
             arguments.Script.Value = $"setTimeout(function() {{ {arguments.Script.Value} }}, 0) ";
         }
         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);
     }
 }
 public void Execute(Arguments arguments)
 {
     try
     {
         IEWrapper ie = IEManager.CurrentIE;
         ie.SetAttribute(arguments.Name.Value,
                         arguments.Value?.Value,
                         arguments.Search.Value,
                         arguments.By.Value,
                         (int)arguments.Timeout.Value.TotalMilliseconds,
                         arguments.NoWait.Value);
     }
     catch (Exception ex)
     {
         throw new ApplicationException($"Error occured while setting value '{arguments.Value?.Value ?? string.Empty}' of attribute '{arguments.Name.Value}'. Message: {ex.Message}", ex);
     }
 }
예제 #4
0
 private IEWrapper CreateIeInstance(bool closeError)
 {
     try
     {
         IEWrapper wrapper = IEManager.AddIE();
         wrapper.Ie = new WatiN.Core.IE();
         if (closeError)
         {
             OnScriptEnd = () =>
             {
                 IEManager.Detach(wrapper);
             };
         }
         return(wrapper);
     }
     catch (Exception ex)
     {
         throw new ApplicationException($"Error occured while trying to create new Internet Explorer instance. Additional message: {ex.Message}", ex);
     }
 }
 public void Execute(Arguments arguments)
 {
     try
     {
         List <string> argumentsList = new List <string>();
         if (arguments.Parameters != null && arguments.Parameters.Value.Count > 0)
         {
             argumentsList = arguments.Parameters.Value.Select(x => x.ToString()).ToList();
         }
         IEWrapper ie = IEManager.CurrentIE;
         ie.FireEvent(arguments.EventName.Value,
                      argumentsList,
                      arguments.Search.Value,
                      arguments.By.Value,
                      (int)arguments.Timeout.Value.TotalMilliseconds,
                      arguments.NoWait.Value);
     }
     catch (Exception ex)
     {
         throw new ApplicationException($"Error occured while firing '{arguments.EventName.Value}' event. Message: {ex.Message}", ex);
     }
 }