コード例 #1
0
        public void MouseEvents()
        {
            Manager.LaunchNewBrowser();
            ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, "WebAii2Pages/JavascriptEvents.html"));

            HtmlTextArea area1 = Find.ById <HtmlTextArea>("area1");

            Assert.IsNotNull(area1);

            // Invoke a click event and verify that the correct button was pressed
            MouseEvent me = new MouseEvent("mousedown");

            me.Button = MouseButton.Left;
            area1.InvokeEvent(me);
            Assert.AreEqual("left", area1.Text);

            me.Button = MouseButton.Right;
            area1.InvokeEvent(me);
            Assert.AreEqual("right", area1.Text);
        }
コード例 #2
0
        public void JavascriptEventNotifications()
        {
            Manager.LaunchNewBrowser();
            ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, "WebAii2Pages/JavascriptEvents.html"));

            HtmlTextArea area2 = Find.ById <HtmlTextArea>("area2");

            Assert.IsNotNull(area2);

            // Invoke a click event, and wait for notification to be received
            _onClickARE.Reset();
            _onClickOccurred = false;
            area2.AddEventListener("click", area2_OnClick);
            area2.InvokeEvent(ScriptEventType.OnClick);
            _onClickARE.WaitOne(500);
            Assert.IsTrue(_onClickOccurred);
        }