Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Type"/> class.
 /// </summary>
 /// <param name="alertOverride">An <see cref="AlertOverride"/> object used to handle JavaScript alerts.</param>
 /// <param name="elementFinder">An <see cref="ElementFinder"/> used to find the element on which to execute the command.</param>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public Type(AlertOverride alertOverride, ElementFinder elementFinder, KeyState keyState)
 {
     this.alertOverride = alertOverride;
     this.finder = elementFinder;
     this.state = keyState;
     this.type = "return (" + JavaScriptLibrary.GetSeleniumScript("type.js") + ").apply(null, arguments);";
 }
Exemplo n.º 2
0
        public CTM_Test()
        {
            InitializeComponent();

            // init local variables
            this.testRunId = 0;
            this.testRunBrowserId = 0;
            this.testDownloadUrl = "";
            this.testBrowser = null;
            this.haltOnError = false;

            this.testHadError = false;

            this.testVariables = new Selenium_Test_Suite_Variables();

            this.seleneseMethods = new Dictionary<String, SeleneseCommand>();
            this.elementFinder = new ElementFinder();
            this.select = new SeleniumOptionSelector(this.elementFinder);

            this.keyState = new KeyState();

            this.tests = new ArrayList();
            this.testCommands = new ArrayList();
        }
Exemplo n.º 3
0
 public ShiftKeyDown(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Type"/> class.
 /// </summary>
 /// <param name="alertOverride">An <see cref="AlertOverride"/> object used to handle JavaScript alerts.</param>
 /// <param name="elementFinder">An <see cref="ElementFinder"/> used to find the element on which to execute the command.</param>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public Type(AlertOverride alertOverride, ElementFinder elementFinder, KeyState keyState)
 {
     this.alertOverride = alertOverride;
     this.finder = elementFinder;
     this.state = keyState;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetaKeyDown"/> class.
 /// </summary>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public MetaKeyDown(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 6
0
 public Type(ElementFinder elementFinder, KeyState keyState)
 {
     this.finder = elementFinder;
     this.state = keyState;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShiftKeyUp"/> class.
 /// </summary>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public ShiftKeyUp(KeyState keyState)
 {
     this.keyState = keyState;
 }
        private void PopulateSeleneseMethods()
        {
            KeyState keyState = new KeyState();
            WindowSelector windows = new WindowSelector(this.driver);

            // Note the we use the names used by the CommandProcessor
            this.seleneseMethods.Add("addLocationStrategy", new AddLocationStrategy(this.elementFinder));
            this.seleneseMethods.Add("addSelection", new AddSelection(this.elementFinder));
            this.seleneseMethods.Add("altKeyDown", new AltKeyDown(keyState));
            this.seleneseMethods.Add("altKeyUp", new AltKeyUp(keyState));
            this.seleneseMethods.Add("assignId", new AssignId(this.elementFinder));
            this.seleneseMethods.Add("attachFile", new AttachFile(this.elementFinder));
            this.seleneseMethods.Add("captureScreenshotToString", new CaptureScreenshotToString());
            this.seleneseMethods.Add("click", new Click(this.alertOverride, this.elementFinder));
            this.seleneseMethods.Add("clickAt", new ClickAt(this.alertOverride, this.elementFinder));
            this.seleneseMethods.Add("check", new Check(this.alertOverride, this.elementFinder));
            this.seleneseMethods.Add("chooseCancelOnNextConfirmation", new SetNextConfirmationState(false));
            this.seleneseMethods.Add("chooseOkOnNextConfirmation", new SetNextConfirmationState(true));
            this.seleneseMethods.Add("close", new Close());
            this.seleneseMethods.Add("createCookie", new CreateCookie());
            this.seleneseMethods.Add("controlKeyDown", new ControlKeyDown(keyState));
            this.seleneseMethods.Add("controlKeyUp", new ControlKeyUp(keyState));
            this.seleneseMethods.Add("deleteAllVisibleCookies", new DeleteAllVisibleCookies());
            this.seleneseMethods.Add("deleteCookie", new DeleteCookie());
            this.seleneseMethods.Add("doubleClick", new DoubleClick(this.elementFinder));
            this.seleneseMethods.Add("dragdrop", new DragAndDrop(this.elementFinder));
            this.seleneseMethods.Add("dragAndDrop", new DragAndDrop(this.elementFinder));
            this.seleneseMethods.Add("dragAndDropToObject", new DragAndDropToObject(this.elementFinder));
            this.seleneseMethods.Add("fireEvent", new FireEvent(this.elementFinder));
            this.seleneseMethods.Add("focus", new FireNamedEvent(this.elementFinder, "focus"));
            this.seleneseMethods.Add("getAlert", new GetAlert(this.alertOverride));
            this.seleneseMethods.Add("getAllButtons", new GetAllButtons());
            this.seleneseMethods.Add("getAllFields", new GetAllFields());
            this.seleneseMethods.Add("getAllLinks", new GetAllLinks());
            this.seleneseMethods.Add("getAllWindowTitles", new GetAllWindowTitles());
            this.seleneseMethods.Add("getAttribute", new GetAttribute(this.elementFinder));
            this.seleneseMethods.Add("getAttributeFromAllWindows", new GetAttributeFromAllWindows());
            this.seleneseMethods.Add("getBodyText", new GetBodyText());
            this.seleneseMethods.Add("getConfirmation", new GetConfirmation(this.alertOverride));
            this.seleneseMethods.Add("getCookie", new GetCookie());
            this.seleneseMethods.Add("getCookieByName", new GetCookieByName());
            this.seleneseMethods.Add("getElementHeight", new GetElementHeight(this.elementFinder));
            this.seleneseMethods.Add("getElementIndex", new GetElementIndex(this.elementFinder));
            this.seleneseMethods.Add("getElementPositionLeft", new GetElementPositionLeft(this.elementFinder));
            this.seleneseMethods.Add("getElementPositionTop", new GetElementPositionTop(this.elementFinder));
            this.seleneseMethods.Add("getElementWidth", new GetElementWidth(this.elementFinder));
            this.seleneseMethods.Add("getEval", new GetEval(this.mutator));
            this.seleneseMethods.Add("getHtmlSource", new GetHtmlSource());
            this.seleneseMethods.Add("getLocation", new GetLocation());
            this.seleneseMethods.Add("getSelectedId", new FindFirstSelectedOptionProperty(this.elementFinder, "id"));
            this.seleneseMethods.Add("getSelectedIds", new FindSelectedOptionProperties(this.elementFinder, "id"));
            this.seleneseMethods.Add("getSelectedIndex", new FindFirstSelectedOptionProperty(this.elementFinder, "index"));
            this.seleneseMethods.Add("getSelectedIndexes", new FindSelectedOptionProperties(this.elementFinder, "index"));
            this.seleneseMethods.Add("getSelectedLabel", new FindFirstSelectedOptionProperty(this.elementFinder, "text"));
            this.seleneseMethods.Add("getSelectedLabels", new FindSelectedOptionProperties(this.elementFinder, "text"));
            this.seleneseMethods.Add("getSelectedValue", new FindFirstSelectedOptionProperty(this.elementFinder, "value"));
            this.seleneseMethods.Add("getSelectedValues", new FindSelectedOptionProperties(this.elementFinder, "value"));
            this.seleneseMethods.Add("getSelectOptions", new GetSelectOptions(this.elementFinder));
            this.seleneseMethods.Add("getSpeed", new NoOp("0"));
            this.seleneseMethods.Add("getTable", new GetTable(this.elementFinder));
            this.seleneseMethods.Add("getText", new GetText(this.elementFinder));
            this.seleneseMethods.Add("getTitle", new GetTitle());
            this.seleneseMethods.Add("getValue", new GetValue(this.elementFinder));
            this.seleneseMethods.Add("getXpathCount", new GetXpathCount());
            this.seleneseMethods.Add("getCssCount", new GetCssCount());
            this.seleneseMethods.Add("goBack", new GoBack());
            this.seleneseMethods.Add("highlight", new Highlight(this.elementFinder));
            this.seleneseMethods.Add("isAlertPresent", new IsAlertPresent(this.alertOverride));
            this.seleneseMethods.Add("isChecked", new IsChecked(this.elementFinder));
            this.seleneseMethods.Add("isConfirmationPresent", new IsConfirmationPresent(this.alertOverride));
            this.seleneseMethods.Add("isCookiePresent", new IsCookiePresent());
            this.seleneseMethods.Add("isEditable", new IsEditable(this.elementFinder));
            this.seleneseMethods.Add("isElementPresent", new IsElementPresent(this.elementFinder));
            this.seleneseMethods.Add("isOrdered", new IsOrdered(this.elementFinder));
            this.seleneseMethods.Add("isSomethingSelected", new IsSomethingSelected());
            this.seleneseMethods.Add("isTextPresent", new IsTextPresent());
            this.seleneseMethods.Add("isVisible", new IsVisible(this.elementFinder));
            this.seleneseMethods.Add("keyDown", new KeyEvent(this.elementFinder, keyState, "doKeyDown"));
            this.seleneseMethods.Add("keyPress", new TypeKeys(this.alertOverride, this.elementFinder));
            this.seleneseMethods.Add("keyUp", new KeyEvent(this.elementFinder, keyState, "doKeyUp"));
            this.seleneseMethods.Add("metaKeyDown", new MetaKeyDown(keyState));
            this.seleneseMethods.Add("metaKeyUp", new MetaKeyUp(keyState));
            this.seleneseMethods.Add("mouseOver", new MouseEvent(this.elementFinder, "mouseover"));
            this.seleneseMethods.Add("mouseOut", new MouseEvent(this.elementFinder, "mouseout"));
            this.seleneseMethods.Add("mouseDown", new MouseEvent(this.elementFinder, "mousedown"));
            this.seleneseMethods.Add("mouseDownAt", new MouseEventAt(this.elementFinder, "mousedown"));
            this.seleneseMethods.Add("mouseMove", new MouseEvent(this.elementFinder, "mousemove"));
            this.seleneseMethods.Add("mouseMoveAt", new MouseEventAt(this.elementFinder, "mousemove"));
            this.seleneseMethods.Add("mouseUp", new MouseEvent(this.elementFinder, "mouseup"));
            this.seleneseMethods.Add("mouseUpAt", new MouseEventAt(this.elementFinder, "mouseup"));
            this.seleneseMethods.Add("open", new Open(this.baseUrl));
            this.seleneseMethods.Add("openWindow", new OpenWindow(new GetEval(this.mutator)));
            this.seleneseMethods.Add("refresh", new Refresh());
            this.seleneseMethods.Add("removeAllSelections", new RemoveAllSelections(this.elementFinder));
            this.seleneseMethods.Add("removeSelection", new RemoveSelection(this.elementFinder));
            this.seleneseMethods.Add("runScript", new RunScript(this.mutator));
            this.seleneseMethods.Add("select", new SelectOption(this.alertOverride, this.elementFinder));
            this.seleneseMethods.Add("selectFrame", new SelectFrame(windows));
            this.seleneseMethods.Add("selectWindow", new SelectWindow(windows));
            this.seleneseMethods.Add("setBrowserLogLevel", new NoOp(null));
            this.seleneseMethods.Add("setContext", new NoOp(null));
            this.seleneseMethods.Add("setSpeed", new NoOp(null));
            this.seleneseMethods.Add("setTimeout", new SetTimeout(this.timer));
            this.seleneseMethods.Add("shiftKeyDown", new ShiftKeyDown(keyState));
            this.seleneseMethods.Add("shiftKeyUp", new ShiftKeyUp(keyState));
            this.seleneseMethods.Add("submit", new Submit(this.alertOverride, this.elementFinder));
            this.seleneseMethods.Add("type", new Selenium.Internal.SeleniumEmulation.Type(this.alertOverride, this.elementFinder, keyState));
            this.seleneseMethods.Add("typeKeys", new TypeKeys(this.alertOverride, this.elementFinder));
            this.seleneseMethods.Add("uncheck", new Uncheck(this.elementFinder));
            this.seleneseMethods.Add("useXpathLibrary", new NoOp(null));
            this.seleneseMethods.Add("waitForCondition", new WaitForCondition(this.mutator));
            this.seleneseMethods.Add("waitForFrameToLoad", new NoOp(null));
            this.seleneseMethods.Add("waitForPageToLoad", new WaitForPageToLoad());
            this.seleneseMethods.Add("waitForPopUp", new WaitForPopup(windows));
            this.seleneseMethods.Add("windowFocus", new WindowFocus());
            this.seleneseMethods.Add("windowMaximize", new WindowMaximize());
        }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyEvent"/> class.
 /// </summary>
 /// <param name="elementFinder">An <see cref="ElementFinder"/> used to find the element on which to execute the command.</param>
 /// <param name="state">A <see cref="KeyState"/> object defining the state of modifier keys.</param>
 /// <param name="eventName">The name of the event to send.</param>
 public KeyEvent(ElementFinder elementFinder, KeyState state, string eventName)
 {
     this.finder = elementFinder;
     this.keyState = state;
     this.eventName = eventName;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ControlKeyUp"/> class.
 /// </summary>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public ControlKeyUp(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AltKeyDown"/> class.
 /// </summary>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public AltKeyDown(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 12
0
 public ControlKeyDown(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ControlKeyUp"/> class.
 /// </summary>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public ControlKeyUp(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyEvent"/> class.
 /// </summary>
 /// <param name="elementFinder">An <see cref="ElementFinder"/> used to find the element on which to execute the command.</param>
 /// <param name="state">A <see cref="KeyState"/> object defining the state of modifier keys.</param>
 /// <param name="eventName">The name of the event to send.</param>
 public KeyEvent(ElementFinder elementFinder, KeyState state, string eventName)
 {
     this.finder    = elementFinder;
     this.keyState  = state;
     this.eventName = eventName;
 }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AltKeyUp"/> class.
 /// </summary>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public AltKeyUp(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetaKeyDown"/> class.
 /// </summary>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public MetaKeyDown(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 17
0
 public AltKeyUp(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 18
0
 public ControlKeyDown(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 19
0
 public ShiftKeyDown(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetaKeyUp"/> class.
 /// </summary>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public MetaKeyUp(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 21
0
 public MetaKeyUp(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShiftKeyUp"/> class.
 /// </summary>
 /// <param name="keyState">A <see cref="KeyState"/> object tracking the state of modifier keys.</param>
 public ShiftKeyUp(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 23
0
 public AltKeyDown(KeyState keyState)
 {
     this.keyState = keyState;
 }
Exemplo n.º 24
0
 public Type(ElementFinder elementFinder, KeyState keyState)
 {
     this.finder = elementFinder;
     this.state  = keyState;
 }