private Task OnRun() { foreach (var step in Steps) { step.ClearStatus(); } return Task.Run(() => { IsEnabled = false; var reg = new Registrator<FirefoxDriver>(new BrowserFactory()); var data = new WebData(); data.SiteUrl = new Uri(Site); var s = new List<IStep>(); foreach (var step in Steps) { if (!step.IsSelected) { continue; } var tag = new Tag(new TagAttribute(step.TagAttribute), step.TagAttributeKey); switch (step.GetCurrentStepType()) { case StepTypes.Action: s.Add(new ActionStep(new ActionTag(tag, step.GetCurrentJSEvent()))); break; case StepTypes.Input: s.Add(new InputStep(new InputTag(tag, step.InputData))); break; } } data.Steps = s; reg.TryRegister(data, StepProcesed); }); }