/// <summary> /// Stop button. /// </summary> private void StopButton_Click(object sender, EventArgs e) { StopButton.HoverColor = Color.DimGray; StopButton.HoverColorLeave = Color.DimGray; StopButton.BackColor = Color.DimGray; StopButton.Enabled = false; StopButton.Invalidate(); StartButton.HoverColor = Color.RoyalBlue; StartButton.HoverColorLeave = Color.RoyalBlue; StartButton.BackColor = Color.RoyalBlue; StartButton.Enabled = true; StartButton.Invalidate(); ClickTask.Abort(); IsClickerStarted = false; if (LeftTick.Checked) { mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); } if (RightTick.Checked) { mouse_event(MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); } if (MiddleTick.Checked) { mouse_event(MOUSEEVENTF_MIDDLEUP | MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0); } }
public ITask Create(IAction action) { ITask task = null; if (taskDic.TryGetValue(action.ActionType, out task)) { return(task); } if (action.ActionType == ActionType.PageAction) { task = new PageTask(manager); } else if (action.ActionType == ActionType.BrowserAction) { task = new BrowserTask(manager); } else if (action.ActionType == ActionType.FindAction) { task = new FindTask(manager); } else if (action.ActionType == ActionType.MouseAction) { task = new MouseTask(manager); } else if (action.ActionType == ActionType.AttributeAction) { task = new AttributeTask(manager); } else if (action.ActionType == ActionType.ScrollAction) { task = new ScrollTask(manager); } else if (action.ActionType == ActionType.ClearDataAction) { task = new ClearDataTask(manager); } else if (action.ActionType == ActionType.WaitAction) { task = new WaitTask(manager); } else if (action.ActionType == ActionType.ClickAction) { task = new ClickTask(manager); } else if (action.ActionType == ActionType.KeyboardAction) { task = new KeyboardTask(manager); } else if (action.ActionType == ActionType.SendKeyAction) { task = new SendKeyTask(manager); } else if (action.ActionType == ActionType.ConditionAction) { task = new ConditionTask(manager); } else if (action.ActionType == ActionType.ClearHistoryAction) { task = new ClearHistoryTask(manager); } else if (action.ActionType == ActionType.TextAction) { task = new TextTask(manager); } else if (action.ActionType == ActionType.ScriptAction) { task = new ScriptTask(manager); } else if (action.ActionType == ActionType.PackageAction) { task = new PackageTask(manager); } taskDic.Add(action.ActionType, task); return(task); }
private BrowserTask CreateTask(TaskInfo task, TestStorage storage) { InitializeBrowser(task, storage); BrowserTask seleniumTask; switch (task.Action) { case ActionType.Click: seleniumTask = new ClickTask(); break; case ActionType.AddCookie: seleniumTask = new AddCookieTask(); break; case ActionType.DeleteCookie: seleniumTask = new DeleteCookieTask(); break; case ActionType.Input: seleniumTask = new InputTask(); break; case ActionType.SelectDropdown: seleniumTask = new SelectDropdownTask(); break; case ActionType.UlSelectDropdown: seleniumTask = new UlSelectDropdownTask(); break; case ActionType.Navigate: seleniumTask = new NavigateTask(); break; case ActionType.SwitchWindow: seleniumTask = new WindowTask(); break; case ActionType.VerifyUi: seleniumTask = new VerifyUiTask(); break; case ActionType.VerifyUrl: seleniumTask = new VerifyUrlTask(); break; case ActionType.Wait: seleniumTask = new WaitTask(); break; case ActionType.WaitUntil: seleniumTask = new WaitUntilLogTask(); break; case ActionType.ExecuteJavaScript: seleniumTask = new ExecuteJavaScriptTask(); break; case ActionType.TakeScreenShot: seleniumTask = new TakeScreenshotTask(); break; case ActionType.NavigateBack: seleniumTask = new NavigateBackTask(); break; case ActionType.CloseWindow: seleniumTask = new WindowTask(); break; case ActionType.VerifyCssProperties: seleniumTask = new VerifyCssPropertiesTask(); break; case ActionType.VerifyAttributes: seleniumTask = new VerifyAttributesTask(); break; case ActionType.HandlePrompt: seleniumTask = new HandlePromptTask(); break; case ActionType.InputEmail: seleniumTask = new InputTask(); break; case ActionType.VerifyCookie: seleniumTask = new VerifyCookieTask(); break; case ActionType.ExtractStringFromUrl: seleniumTask = new ExtractStringFromUrlTask(); break; case ActionType.DecodeUrl: seleniumTask = new DecodeUrlTask(); break; case ActionType.RewriteUrl: seleniumTask = new RewriteUrlTask(); break; case ActionType.FetchDataFromUi: seleniumTask = new FetchDataFromUiTask(); break; case ActionType.Refresh: seleniumTask = new RefreshTask(); break; case ActionType.AddAuthHeader: seleniumTask = new AddAuthHeaderTask(); break; case ActionType.MatchLog: seleniumTask = new MatchLogTask(); break; case ActionType.ReadValueFromLog: seleniumTask = new ReadValueFromLogTask(); break; case ActionType.SwitchContextToIframe: seleniumTask = new WindowTask(); break; default: seleniumTask = new BrowserTask(); break; } seleniumTask.CurrentBrowser = task.Parent.Browser; return(seleniumTask); }