public override object DoRun() { if (What.ToLower() != "browser") { throw new NotImplementedException("Resizing other windows than 'browser' is not supported. Please use 'Browser' as a what parameter of Resize."); } Selenium.WebDriver.Manage().Window.Size = new Size(Width, Height); return(true); }
public override object DoRun() { var response = "Reload completed."; if (What.IsNullOrEmpty()) { var fileObjectAccesses = Interpreter.Data.DataAccesses.OfType <FileObjectAccess>(); foreach (var dataAccess1 in fileObjectAccesses) { dataAccess1.ForceReload(); } response += $"\n{fileObjectAccesses.Count()} files reloaded."; } else { var foa = Interpreter.Data.DataAccesses.OfType <FileObjectAccess>() .FirstOrDefault(x => x.Path.ToLower().Contains(What.ToLower())); if (foa == null) { return(new ExceptionAnswer( $"File with '{What}' is not registered. You must specify a full name or a substring of a loaded file (case-insensitive, no spaces). The following files are registered: \n\t" + string.Join("\n\t", Interpreter.Data.DataAccesses.OfType <FileObjectAccess>().Select(x => x.Path)))); } foa?.ForceReload(); response += $"\n File reloaded: {foa.Path}"; } Interpreter.Plan = Interpreter.Data.GetAll <Keyword>().ToList(); if (Interpreter.Iterator.Index >= Interpreter.Plan.ToList().Count) { Interpreter.Iterator.Index = 0; } return(new SuccessAnswer(response)); }
public override object DoRun() { object instance = null; var arguments = new List <object>(); if (Interpreter.Language.CanParse(What.ToLower())) { instance = Interpreter.Language.ParseKeyword(What.ToLower()); } else { var type = TypeRegistry.Types.FirstOrDefault(x => x.Name.ToLower() == What.ToLower()); if (type == null && What.Contains(" ")) { var firstPart = What.Split(' ')[0]; arguments.Add(What.Substring(firstPart.Length + 1)); type = TypeRegistry.Types.FirstOrDefault(x => x.Name.ToLower() == firstPart.ToLower()); } if (type == null) { throw new ArgumentException($"{What} is not recognized."); } instance = Activator.CreateInstance(type, args: arguments.ToArray()); } Data.Add(instance); (instance as IAutoRegistered)?.Register(Interpreter); if (instance is IKeyword) { Interpreter.AddToPlan(instance as IKeyword); } return(new SuccessAnswer($"Added {instance} to Data Context.")); }