/// <summary> /// Adds a navigation action to the action list /// </summary> /// <param name="windowName">window where it was performed</param> /// <param name="url">url being navigated to</param> /// <returns>action created (mainly for testing)</returns> public ActionNavigate AddNavigate(string windowName, string url) { var action = new ActionNavigate(_browsers[windowName]) { Url = url }; AddAction(action); return(action); }
private string WriteNavigateActionToFile() { const string filename = @"C:\Work\TestRecorder3\tests\output_navigate.xml"; var action = new ActionNavigate(new BrowserWindow("window")) { Url = "http://www.google.com" }; SerializeActionHelper.SerializeActionListToFile(new List <ActionBase> { action }, filename); return(filename); }
public void WriteNavigate() { var generator = new WatiNCSharp(GetNUnitTemplate()); var nav = new ActionNavigate(new BrowserWindow("window")) { Url = "http://www.google.com" }; generator.ActionToCode(nav); Assert.AreEqual(1, generator.Code.Count, "different than 1 code line"); Assert.That(generator.Code[0] == "window.GoTo(\"http://www.google.com\");", "other than valid code"); }
static public ActionBase Create(string ActionObjectString) { ActionBase output = null; try { output = Activator.CreateInstance("AutoRobo.Core", "AutoRobo.Core.Actions." + ActionObjectString).Unwrap() as ActionBase; } catch { //兼容老版本数据 switch (ActionObjectString) { case "BrowserClick": output = new ActionClick(); break; case "Navigate": output = new ActionNavigate(); break; case "ScriptPart": output = new ActionScriptPart(); break; case "AlertHandler": output = new ActionAlertHandler(); break; case "ActionDoubleClick": output = new ActionDoubleClick(); break; case "ActionFireEvent": output = new ActionFireEvent(); break; case "ActionKey": output = new ActionKey(); break; case "Mouse": output = new ActionMouse(); break; case "RadioButton": output = new ActionRadio(); break; case "Checkbox": output = new ActionCheckbox(); break; case "SelectList": output = new ActionSelectList(); break; case "TypeText": output = new ActionTypeText(); break; case "DirectionKey": output = new ActionDirectionKey(); break; case "Sleep": output = new ActionSleep(); break; case "Wait": output = new ActionWait(); break; case "ValidateCode": output = new ActionValidateCode(); break; case "FileUpload": output = new ActionFileDialog(); break; case "ValidateImage": output = new ActionValidateImage(); break; case "JavascriptInterpreter": output = new ActionJavascriptInterpreter(); break; case "SubmitClick": output = new ActionSubmitClick(); break; case "CloseWindow": output = new ActionCloseWindow(); break; case "WindowBack": output = new ActionBack(); break; case "WindowForward": output = new ActionForward(); break; case "WindowOpen": output = new ActionOpenWindow(); break; case "WindowRefresh": output = new ActionRefresh(); break; case "SubElementFinder": output = new ActionSubElements(); break; case "CallFunction": output = new ActionCall(); break; case "ActionForeach": output = new ActionForeach(); break; case "ActionBrowser": output = new ActionBrowser(); break; case "ActionThread": output = new ActionThread(); break; //case "AddChildrenToList": output = new AddChildrenToList(); break; } } //if (output == null) //{ // throw new ApplicationException(string.Format("{0}对应的活动未找到", ActionObjectString)); //} return(output); }