示例#1
0
        public static void DrawCircle(WindowsDriver <WindowsElement> session)
        {
            // Draw a circle with radius 300 and 40 (x, y) points
            const int radius = 300;
            const int points = 40;

            // Select the Brushes toolbox to have the Brushes Pane sidebar displayed and ensure that Marker is selected
            session.FindElementByAccessibilityId("Toolbox").FindElementByAccessibilityId("TopBar_ArtTools").Click();
            session.FindElementByAccessibilityId("SidebarWrapper").FindElementByAccessibilityId("Marker3d").Click();

            // Locate the drawing surface
            WindowsElement inkCanvas = session.FindElementByAccessibilityId("InteractorFocusWrapper");

            // Draw the circle with a single touch actions
            OpenQA.Selenium.Appium.Interactions.PointerInputDevice touchContact = new OpenQA.Selenium.Appium.Interactions.PointerInputDevice(PointerKind.Touch);
            ActionSequence touchSequence = new ActionSequence(touchContact, 0);

            touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, 0, -radius, TimeSpan.Zero));
            touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));
            for (double angle = 0; angle <= 2 * Math.PI; angle += 2 * Math.PI / points)
            {
                touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, (int)(Math.Sin(angle) * radius), -(int)(Math.Cos(angle) * radius), TimeSpan.Zero));
            }
            touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                touchSequence
            });

            // Verify that the drawing operations took place
            WindowsElement undoButton = session.FindElementByAccessibilityId("UndoIcon");
        }
示例#2
0
        public void Touch_DragAndDrop()
        {
            WindowsElement appNameTitle = FindAppTitleBar();
            const int      offset       = 100;

            // Save application window original position
            Point originalPosition = session.Manage().Window.Position;

            Assert.IsNotNull(originalPosition);

            // Send touch down, move, and up actions combination to perform a drag and drop
            // action on the app title bar. These actions reposition the application window.
            PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     sequence    = new ActionSequence(touchDevice, 0);

            sequence.AddAction(touchDevice.CreatePointerMove(appNameTitle, 0, 0, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerMove(CoordinateOrigin.Pointer, offset, offset, TimeSpan.FromSeconds(1)));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });
            Thread.Sleep(TimeSpan.FromSeconds(1));

            // Verify that application window is now re-positioned from the original location
            Assert.AreNotEqual(originalPosition, session.Manage().Window.Position);
            Assert.IsTrue(originalPosition.Y < session.Manage().Window.Position.Y);

            // Restore application window original position
            session.Manage().Window.Position = originalPosition;
            Assert.AreEqual(originalPosition, session.Manage().Window.Position);
        }
示例#3
0
        private void Tap(int xOffset, int yOffset)
        {
            System.Threading.Thread.Sleep(100);
            //the screenshot can take the place of sleeping instead

            Console.WriteLine("Tap start");
            PointerInputDevice touch         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touchSequence = new ActionSequence(touch, 0);

            touchSequence.AddAction(touch.CreatePointerMove(CoordinateOrigin.Pointer, xOffset, yOffset, TimeSpan.Zero));
            touchSequence.AddAction(touch.CreatePointerDown(PointerButton.TouchContact));
            touchSequence.AddAction(touch.CreatePointerUp(PointerButton.TouchContact));
            List <ActionSequence> actions = new List <ActionSequence> {
                touchSequence
            };

            session.PerformActions(actions);

            ////String filename = "Tap_" + System.DateTime.Now.ToString("yyyymmdd-HHmm-ssfff") + "_" + xOffset + "_" + yOffset + ".png";
            ////Bitmap bmp = imageComparer.ScreenshotLockBits(width, height);
            ////bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png);


            Console.WriteLine("Echo: " + actions[actions.Count - 1].ToString());
            Console.WriteLine("Tap end");
        }
示例#4
0
        private void Tap(int xOffset, int yOffset)
        {
            System.Threading.Thread.Sleep(100);
            //the screenshot can take the place of sleeping instead

            Console.WriteLine("Tap start");
            PointerInputDevice touch         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touchSequence = new ActionSequence(touch, 0);

            touchSequence.AddAction(touch.CreatePointerMove(CoordinateOrigin.Pointer, xOffset, yOffset, TimeSpan.Zero));
            touchSequence.AddAction(touch.CreatePointerDown(PointerButton.TouchContact));
            touchSequence.AddAction(touch.CreatePointerUp(PointerButton.TouchContact));
            List <ActionSequence> actions = new List <ActionSequence> {
                touchSequence
            };

            session.PerformActions(actions);

            if (record)
            {
                String eventFolder = installDirectory + "\\" + currentEventName;
                String filename    = eventFolder + "\\" + currentEventName + "_" + currentEventTapCount + ".png";
                currentEventTapCount++;
                Bitmap bmp = imageComparer.ScreenshotLockBits(width, height);
                bmp.Save(filename, ImageFormat.Png);
                bmp.Dispose();//doesn't work?
            }

            Console.WriteLine("Echo: " + actions[actions.Count - 1].ToString());
            Console.WriteLine("Tap end");
        }
示例#5
0
        public void DrawConcentricSquaresWithVaryingDuration()
        {
            const int             concentricSquareCount = 8; // Paint application only supports up to 10 touch inputs
            List <ActionSequence> actionSequencesList   = new List <ActionSequence>();

            // Draw N concentric rectangles with varying speed defined by the duration specified in durationMs
            for (int i = 0, radius = defaultRadius, durationMs = 1000; i < concentricSquareCount && radius > 0; i++, radius -= radiusOffset)
            {
                OpenQA.Selenium.Appium.Interactions.PointerInputDevice touchContact = new OpenQA.Selenium.Appium.Interactions.PointerInputDevice(PointerKind.Touch);
                ActionSequence touchSequence = new ActionSequence(touchContact, 0);
                touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, -radius, -radius, TimeSpan.Zero));
                touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));
                touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, radius, -radius, TimeSpan.FromMilliseconds(durationMs)));
                touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, radius, radius, TimeSpan.FromMilliseconds(durationMs)));
                touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, -radius, radius, TimeSpan.FromMilliseconds(durationMs)));
                touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, -radius, -radius, TimeSpan.FromMilliseconds(durationMs)));
                touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));
                actionSequencesList.Add(touchSequence);
                durationMs += 300;
            }

            ourSession.PerformActions(actionSequencesList);

            // Verify that the drawing operations took place
            Assert.IsTrue(undoButton.Displayed);
            Assert.IsTrue(undoButton.Enabled);
        }
示例#6
0
        public void Touch_LongClick()
        {
            // Create a new test alarm
            string alarmName = "LongTapTest";

            DeletePreviouslyCreatedAlarmEntry(alarmName);
            AddAlarmEntry(alarmName);
            Thread.Sleep(TimeSpan.FromSeconds(3));

            var alarmEntries = session.FindElementsByXPath($"//ListItem[starts-with(@Name, \"{alarmName}\")]");

            Assert.IsNotNull(alarmEntries);
            Assert.AreEqual(1, alarmEntries.Count);

            // Open a the context menu on the alarm entry using long tap (press and hold) action and click delete
            PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     sequence    = new ActionSequence(touchDevice, 0);

            sequence.AddAction(touchDevice.CreatePointerMove(alarmEntries[0], 0, 0, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerMove(alarmEntries[0], 0, 0, TimeSpan.FromSeconds(3)));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });

            Thread.Sleep(TimeSpan.FromSeconds(1));
            session.FindElementByName("Delete").Click();
            Thread.Sleep(TimeSpan.FromSeconds(1));

            alarmEntries = session.FindElementsByXPath($"//ListItem[starts-with(@Name, \"{alarmName}\")]");
            Assert.IsNotNull(alarmEntries);
            Assert.AreEqual(0, alarmEntries.Count);
        }
示例#7
0
        public void ZoomingOutMultiTouchWithInterpolation()
        {
            // Set pointer move Duration to 300 ms to implicitly generate 6 interpolation moves that are performed every 50 ms
            TimeSpan moveDuration = TimeSpan.FromMilliseconds(300);

            // Drag a touch contact diagonally in SW direction approaching the other contact point
            PointerInputDevice touch1         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touch1Sequence = new ActionSequence(touch1, 0);

            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 50, -50, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerDown(PointerButton.TouchContact));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 20, -20, moveDuration));
            touch1Sequence.AddAction(touch1.CreatePointerUp(PointerButton.TouchContact));

            // Drag a touch contact diagonally in NE direction approaching the other contact point
            PointerInputDevice touch2         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touch2Sequence = new ActionSequence(touch2, 0);

            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -50, 50, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerDown(PointerButton.TouchContact));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -20, 20, moveDuration));
            touch2Sequence.AddAction(touch2.CreatePointerUp(PointerButton.TouchContact));

            // Perform the 2 fingers zoom out (pinch) multi-touch sequences defined above
            session.PerformActions(new List <ActionSequence> {
                touch1Sequence, touch2Sequence
            });

            // Ensure that the zoom level now is less than 100%
            Assert.IsTrue(int.Parse(zoomScaleTextBox.Text) < 100);
        }
示例#8
0
        public void Touch_Flick()
        {
            // Navigate to add alarm page
            session.FindElementByAccessibilityId("AddAlarmButton").Click();
            session.FindElementByAccessibilityId("AlarmTimePicker").Click();
            Thread.Sleep(TimeSpan.FromSeconds(1));

            WindowsElement minuteSelector = session.FindElementByAccessibilityId("MinuteLoopingSelector");
            WindowsElement minute00       = session.FindElementByName("00");

            Assert.IsNotNull(minuteSelector);
            Assert.IsNotNull(minute00);
            Assert.IsTrue(minute00.Displayed);

            // Perform touch flick down action to scroll the minute hiding 00 minutes that was shown
            PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     sequence    = new ActionSequence(touchDevice, 0);

            sequence.AddAction(touchDevice.CreatePointerMove(minuteSelector, 0, 0, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerMove(minuteSelector, 0, 500, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });
            Thread.Sleep(TimeSpan.FromSeconds(2));
            Assert.IsFalse(minute00.Displayed);
        }
        public void DrawBasicSquareWithExtraAttributes()
        {
            Point canvasCoordinate = inkCanvas.Coordinates.LocationInViewport;
            Size  squareSize       = new Size(inkCanvas.Size.Width * 3 / 5, inkCanvas.Size.Height * 3 / 5);
            Point A = new Point(canvasCoordinate.X + inkCanvas.Size.Width / 5, canvasCoordinate.Y + inkCanvas.Size.Height / 5);

            // A        B
            //  ┌──────┐   Draw a basic ABCD square using Pen through the Actions API
            //  │      │   in pointer origin mode:
            //  │      │   - X is relative to the previous X position in this session
            //  └──────┘   - Y is relative to the previous Y position in this session
            // D        C
            PointerInputDevice penDevice          = new PointerInputDevice(PointerKind.Pen);
            ActionSequence     sequence           = new ActionSequence(penDevice, 0);
            PenInfo            penExtraAttributes = new PenInfo {
                TiltX = 45, TiltY = 45, Twist = 45
            };

            // Draw line AB from point A to B with attributes defined in penExtraAttributes
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Pointer, A.X, A.Y, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact, penExtraAttributes));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Pointer, squareSize.Width, 0, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw line BC from point B to C and apply maximum (0.9f) pressure as the pen draw between the points
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Pointer, 0, squareSize.Height, TimeSpan.Zero, new PenInfo {
                Pressure = 0.9f
            }));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw line CD from point C to D and keep the maximum pressure by not changing the pressure attribute
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Pointer, -squareSize.Width, 0, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw line DA from point D to A and reduce the pressure to minimum (0.1f) as the pen draw between the points
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Pointer, 0, -squareSize.Height, TimeSpan.Zero, new PenInfo {
                Pressure = 0.1f
            }));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            newStickyNoteSession.PerformActions(new List <ActionSequence> {
                sequence
            });

            try
            {
                var result = newStickyNoteSession.FindElementByAccessibilityId("RichEditBox");
                Assert.Fail("RichEditBox should not be defined anymore after a pen input is successfully performed.");
            }
            catch { }
        }
示例#10
0
        private void Tap(int xOffset, int yOffset)
        {
            PointerInputDevice touch         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touchSequence = new ActionSequence(touch, 0);

            touchSequence.AddAction(touch.CreatePointerMove(zoomInteractor, xOffset, yOffset, TimeSpan.Zero));
            touchSequence.AddAction(touch.CreatePointerDown(PointerButton.TouchContact));
            touchSequence.AddAction(touch.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                touchSequence
            });
        }
示例#11
0
        public void TapTest2()
        {
            //process ID
            Activate(3316);

            // Draw a circle with radius 300 and 40 (x, y) points
            const int radius = 300;
            const int points = 40;

            // Draw the circle with a single touch actions
            PointerInputDevice touchContact  = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touchSequence = new ActionSequence(touchContact, 0);

            //touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, 0, -radius, TimeSpan.Zero));
            //touchSequence.AddAction(touchContact.CreatePointerMove(paintCanvas, 0, -radius, TimeSpan.Zero));
            //touchSequence.AddAction(touchContact.CreatePointerMove(CoordinateOrigin.Viewport, 0, 0, TimeSpan.Zero));
            //touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));

            //touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));
            //for (double angle = 0; angle <= 2 * Math.PI; angle += 2 * Math.PI / points)
            //{
            //    //touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, (int)(Math.Sin(angle) * radius), -(int)(Math.Cos(angle) * radius), TimeSpan.Zero));

            //    touchSequence.AddAction(touchContact.CreatePointerMove(CoordinateOrigin.Viewport, (int)(Math.Sin(angle) * radius), -(int)(Math.Cos(angle) * radius), TimeSpan.Zero));

            //    //touchSequence.AddAction(touchContact.CreatePointerMove(paintCanvas, 0, -radius, TimeSpan.Zero));
            //}
            //touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));

            touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));
            touchSequence.AddAction(touchContact.CreatePointerMove(CoordinateOrigin.Viewport, 1, 1, TimeSpan.Zero));
            touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));
            touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));
            touchSequence.AddAction(touchContact.CreatePointerMove(CoordinateOrigin.Viewport, 400, 400, TimeSpan.Zero));
            touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));
            //touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));
            //touchSequence.AddAction(touchContact.CreatePointerMove(CoordinateOrigin.Viewport, 400, 400, TimeSpan.Zero));
            //touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));
            //touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));
            //touchSequence.AddAction(touchContact.CreatePointerMove(CoordinateOrigin.Viewport, 400, 400, TimeSpan.Zero));
            //touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));


            List <ActionSequence> actionList = new List <ActionSequence> {
                touchSequence
            };

            for (int i = 0; i < actionList.Count; i++)
            {
                Console.WriteLine(actionList[i].ToString());
            }
            session.PerformActions(actionList);
        }
示例#12
0
        public void DrawWithPen()
        {
            PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);

            // Draw rectangle ABCD (consisting of AB, BC, CD, and DA lines)
            ActionSequence sequence = new ActionSequence(penDevice, 0);

            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, A.X, A.Y, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, B.X, B.Y, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, C.X, C.Y, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, D.X, D.Y, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, A.X, A.Y, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });

            // Fill the rectangle ABCD at the middle of the crosshair position (Point E)
            brushesPane.FindElementByAccessibilityId("FillBucket").Click();

            ActionSequence fillSequence = new ActionSequence(penDevice, 0);

            fillSequence.AddAction(penDevice.CreatePointerMove(inkCanvas, E.X, E.Y, TimeSpan.Zero));
            fillSequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            fillSequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
            session.PerformActions(new List <ActionSequence> {
                fillSequence
            });

            // Erase by pressing PenEraser button along Point E X-Axis and Y-Axis to make the crosshair
            ActionSequence eraseSequence = new ActionSequence(penDevice, 0);

            eraseSequence.AddAction(penDevice.CreatePointerMove(inkCanvas, A.X - 5, E.Y, TimeSpan.Zero));
            eraseSequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenEraser));
            eraseSequence.AddAction(penDevice.CreatePointerMove(inkCanvas, B.X + 5, E.Y, TimeSpan.FromSeconds(.5)));
            eraseSequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenEraser));
            eraseSequence.AddAction(penDevice.CreatePointerMove(inkCanvas, E.X, C.Y, TimeSpan.Zero));
            eraseSequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenEraser));
            eraseSequence.AddAction(penDevice.CreatePointerMove(inkCanvas, E.X, B.Y, TimeSpan.FromSeconds(.5)));
            eraseSequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenEraser));
            session.PerformActions(new List <ActionSequence> {
                eraseSequence
            });

            // Verify that the drawing operations took place
            Assert.IsTrue(undoButton.Displayed);
            Assert.IsTrue(undoButton.Enabled);
        }
示例#13
0
 public void ActionsError_UnsupportedPointerType()
 {
     try
     {
         // Perform move action using unsupported pointer type
         PointerInputDevice penDevice = new PointerInputDevice((PointerKind)(-1));
         ActionSequence     sequence  = new ActionSequence(penDevice, 0);
         sequence.AddAction(penDevice.CreatePointerMove(alarmTabElement, 0, 0, TimeSpan.Zero));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException) { }
 }
示例#14
0
        public void Pen_Scroll_Horizontal()
        {
            // Different Alarm & Clock application version uses different UI elements
            if (AlarmTabClassName == "ListViewItem")
            {
                // The latest Alarms & Clock application no longer has horizontal scroll UI elements
            }
            else
            {
                WindowsElement homePagePivot       = session.FindElementByAccessibilityId("HomePagePivot");
                WindowsElement alarmPivotItem      = session.FindElementByAccessibilityId(AlarmTabAutomationId);
                WindowsElement worldClockPivotItem = session.FindElementByAccessibilityId(WorldClockTabAutomationId);
                Assert.IsNotNull(homePagePivot);
                Assert.IsNotNull(alarmPivotItem);
                Assert.IsNotNull(worldClockPivotItem);
                Assert.IsTrue(alarmPivotItem.Selected);
                Assert.IsFalse(worldClockPivotItem.Selected);

                // Perform scroll left pen action to switch from Alarm to WorldClock tab
                PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
                ActionSequence     sequence  = new ActionSequence(penDevice, 0);
                sequence.AddAction(penDevice.CreatePointerMove(homePagePivot, 0, 0, TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
                sequence.AddAction(penDevice.CreatePointerMove(homePagePivot, -session.Manage().Window.Size.Width / 2, 0, TimeSpan.FromSeconds(.5)));
                sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
                session.PerformActions(new List <ActionSequence> {
                    sequence
                });

                Thread.Sleep(TimeSpan.FromSeconds(1));
                Assert.IsFalse(alarmPivotItem.Selected);
                Assert.IsTrue(worldClockPivotItem.Selected);

                // Perform scroll right pen action to switch back from WorldClock to Alarm tab
                sequence = new ActionSequence(penDevice, 0);
                sequence.AddAction(penDevice.CreatePointerMove(homePagePivot, 0, 0, TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
                sequence.AddAction(penDevice.CreatePointerMove(homePagePivot, session.Manage().Window.Size.Width / 2, 0, TimeSpan.FromSeconds(.5)));
                sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
                session.PerformActions(new List <ActionSequence> {
                    sequence
                });

                Thread.Sleep(TimeSpan.FromSeconds(1));
                Assert.IsTrue(alarmPivotItem.Selected);
                Assert.IsFalse(worldClockPivotItem.Selected);
            }
        }
示例#15
0
        public void TapTest()
        {
            PointerInputDevice touch         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touchSequence = new ActionSequence(touch, 0);

            touchSequence.AddAction(touch.CreatePointerMove(zoomInteractor, 0, 0, TimeSpan.Zero));
            touchSequence.AddAction(touch.CreatePointerDown(PointerButton.TouchContact));
            touchSequence.AddAction(touch.CreatePointerUp(PointerButton.TouchContact));
            touchSequence.AddAction(touch.CreatePointerDown(PointerButton.TouchContact));
            touchSequence.AddAction(touch.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                touchSequence
            });

            Assert.IsTrue(true);
        }
示例#16
0
        public void DrawBasicSquare()
        {
            Point canvasCoordinate = inkCanvas.Coordinates.LocationInViewport;
            Size  squareSize       = new Size(inkCanvas.Size.Width * 3 / 5, inkCanvas.Size.Height * 3 / 5);
            Point A = new Point(canvasCoordinate.X + inkCanvas.Size.Width / 5, canvasCoordinate.Y + inkCanvas.Size.Height / 5);

            // A        B
            //  ┌──────┐   Draw a basic ABCD square using Pen through the Actions API
            //  │      │   in viewport(default) origin mode:
            //  │      │   - X is absolute horizontal position in the session window
            //  └──────┘   - Y is absolute vertical position in the session window
            // D        C
            PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
            ActionSequence     sequence  = new ActionSequence(penDevice, 0);

            // Draw line AB from point A to B
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, A.X, A.Y, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, A.X + squareSize.Width, A.Y, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw line BC from point B to C
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, A.X + squareSize.Width, A.Y + squareSize.Height, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw line CD from point C to D
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, A.X, A.Y + squareSize.Height, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw line DA from point D to A
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, A.X, A.Y, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            newStickyNoteSession.PerformActions(new List <ActionSequence> {
                sequence
            });

            try
            {
                var result = newStickyNoteSession.FindElementByAccessibilityId("RichEditBox");
                Assert.Fail("RichEditBox should not be defined anymore after a pen input is successfully performed.");
            }
            catch { }
        }
示例#17
0
        public static void DrawTriangle(WindowsDriver <WindowsElement> session)
        {
            OpenQA.Selenium.Appium.Interactions.PointerInputDevice penDevice = new OpenQA.Selenium.Appium.Interactions.PointerInputDevice(PointerKind.Pen);

            // Select the Brushes toolbox to have the Brushes Pane sidebar displayed and ensure that Marker is selected
            session.FindElementByAccessibilityId("Toolbox").FindElementByAccessibilityId("TopBar_ArtTools").Click();
            session.FindElementByAccessibilityId("SidebarWrapper").FindElementByAccessibilityId("PixelPencil3d").Click();

            // Locate the drawing surface
            WindowsElement inkCanvas = session.FindElementByAccessibilityId("InteractorFocusWrapper");

            Point    canvasCoordinate = inkCanvas.Coordinates.LocationInViewport;
            Size     squareSize       = new Size(inkCanvas.Size.Width * 3 / 5, inkCanvas.Size.Height * 3 / 5);
            Point    A       = new Point(canvasCoordinate.X + inkCanvas.Size.Width / 5, canvasCoordinate.Y + inkCanvas.Size.Height / 5);
            TimeSpan howFast = TimeSpan.FromMilliseconds(500.0);

            ActionSequence sequence = new ActionSequence(penDevice, 0);

            var halfWidth  = (inkCanvas.Size.Width / 2) + 100;
            var halfHeight = (inkCanvas.Size.Height / 2) + 500;

            // left base
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, halfWidth, halfHeight, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, halfWidth - 1000, halfHeight, howFast));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // right base
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, halfWidth, halfHeight, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, halfWidth + 1000, halfHeight, howFast));
            //sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // right top
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, halfWidth + 1000, halfHeight, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, halfWidth, halfHeight - 1000, howFast));

            // left top
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, halfWidth, halfHeight - 1000, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, halfWidth - 1000, halfHeight, howFast));


            session.PerformActions(new List <ActionSequence> {
                sequence
            });
        }
示例#18
0
        public void Touch_DoubleClick()
        {
            WindowsElement appNameTitle   = FindAppTitleBar();
            WindowsElement maximizeButton = session.FindElementByAccessibilityId("Maximize");

            // Set focus on the application by switching window to itself
            session.SwitchTo().Window(session.CurrentWindowHandle);

            // Restore the application window if it is currently maximized
            if (!maximizeButton.Text.Contains("Maximize"))
            {
                maximizeButton.Click();
            }

            // Verify that window is currently not maximized
            Assert.IsTrue(maximizeButton.Text.Contains("Maximize"));

            // Perform touch double click action on the title bar to maximize the application window
            PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     sequence    = new ActionSequence(touchDevice, 0);

            sequence.AddAction(touchDevice.CreatePointerMove(appNameTitle, 0, 0, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });
            Thread.Sleep(TimeSpan.FromSeconds(1));
            Assert.IsFalse(maximizeButton.Text.Contains("Maximize"));

            // Perform touch double click action on the title bar to restore the application window
            sequence = new ActionSequence(touchDevice, 0);
            sequence.AddAction(touchDevice.CreatePointerMove(appNameTitle, 0, 0, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });
            Thread.Sleep(TimeSpan.FromSeconds(1));
            Assert.IsTrue(maximizeButton.Text.Contains("Maximize"));
        }
示例#19
0
 public void ActionsError_BadPointerMoveDuration()
 {
     try
     {
         // Perform pen move action using a bad duration value
         PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
         ActionSequence     sequence  = new ActionSequence(penDevice, 0);
         sequence.AddAction(penDevice.CreatePointerMove(CoordinateOrigin.Viewport, 0, 0, TimeSpan.FromMilliseconds(-1)));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.ActionsArgumentDuration, exception.Message);
     }
 }
示例#20
0
 public void ActionsError_StaleElement()
 {
     try
     {
         // Perform pen move action on stale element
         PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
         ActionSequence     sequence  = new ActionSequence(penDevice, 0);
         sequence.AddAction(penDevice.CreatePointerMove(GetStaleElement(), 0, 0, TimeSpan.Zero));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.IsTrue(exception.Message.EndsWith(ErrorStrings.ActionsStaleElementReference));
     }
 }
示例#21
0
 public void ActionsError_BadPointerButton_PointerUp()
 {
     try
     {
         // Perform pen up action using a bad button value
         PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
         ActionSequence     sequence  = new ActionSequence(penDevice, 0);
         sequence.AddAction(penDevice.CreatePointerUp((PointerButton)(-1)));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.ActionsArgumentButton, exception.Message);
     }
 }
示例#22
0
 public void ActionsError_UnimplementedPointerType()
 {
     try
     {
         // Perform move action using unimplemented pointer type such as mouse
         PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Mouse);
         ActionSequence     sequence  = new ActionSequence(penDevice, 0);
         sequence.AddAction(penDevice.CreatePointerMove(alarmTabElement, 0, 0, TimeSpan.Zero));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.IsTrue(exception.Message.StartsWith(ErrorStrings.ActionsUnimplementedPointerType));
     }
 }
示例#23
0
 public void ActionsError_NoSuchWindow()
 {
     try
     {
         // Perform pen move action on session that is no longer open
         PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
         ActionSequence     sequence  = new ActionSequence(penDevice, 0);
         sequence.AddAction(penDevice.CreatePointerMove(Utility.GetOrphanedElement(), 0, 0, TimeSpan.Zero));
         Utility.GetOrphanedSession().PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.NoSuchWindow, exception.Message);
     }
 }
示例#24
0
        public void Touch_Click_OriginPointer()
        {
            WindowsElement alarmPivotItem      = session.FindElementByAccessibilityId("AlarmPivotItem");
            WindowsElement worldClockPivotItem = session.FindElementByAccessibilityId("WorldClockPivotItem");
            int            relativeX           = 0; // Initial x coordinate
            int            relativeY           = 0; // Initial y coordinate

            Assert.IsNotNull(alarmPivotItem);
            Assert.IsNotNull(worldClockPivotItem);
            Assert.IsTrue(alarmPivotItem.Selected);
            Assert.IsFalse(worldClockPivotItem.Selected);

            // Perform touch click action using pointer coordinate origin to switch from Alarm to WorldClock tab
            PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     sequence    = new ActionSequence(touchDevice, 0);

            relativeX = worldClockPivotItem.Location.X - relativeX;
            relativeY = worldClockPivotItem.Location.Y - relativeY;
            sequence.AddAction(touchDevice.CreatePointerMove(CoordinateOrigin.Pointer, relativeX, relativeY, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });

            Thread.Sleep(TimeSpan.FromSeconds(1));
            Assert.IsFalse(alarmPivotItem.Selected);
            Assert.IsTrue(worldClockPivotItem.Selected);

            // Perform touch click action using pointer coordinate origin to switch from WorldClock to Alarm tab
            sequence  = new ActionSequence(touchDevice, 0);
            relativeX = alarmPivotItem.Location.X - relativeX;
            relativeY = alarmPivotItem.Location.Y - relativeY;
            sequence.AddAction(touchDevice.CreatePointerMove(CoordinateOrigin.Pointer, relativeX, relativeY, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });

            Thread.Sleep(TimeSpan.FromSeconds(1));
            Assert.IsTrue(alarmPivotItem.Selected);
            Assert.IsFalse(worldClockPivotItem.Selected);
        }
        /// <summary>
        /// Move to and bring element to focus on screen using touch pointer.
        /// </summary>
        /// <param name="driver">driver</param>
        /// <param name="element">element to focus on</param>
        /// <param name="x">horizontal offset from origin</param>
        /// <param name="y">vertical offset from origin</param>
        public static void MoveTo(this AppiumDriver <AppiumWebElement> driver, AppiumWebElement element, int x, int y)
        {
            //ToDo: Make the scroll and tap work.
            Interact.PointerInputDevice inputDevice = new Interact.PointerInputDevice(PointerKind.Touch);
            ActionSequence actionSequence           = new ActionSequence(inputDevice);

            actionSequence.AddAction(inputDevice.CreatePointerMove(element, x, y, TimeSpan.FromSeconds(1)));
            try {
                driver.PerformActions(new List <ActionSequence> {
                    actionSequence
                });
            } catch {
                TestContext.WriteLine($"Move to element: {element.Text} failed.");

                //ignore
            } finally {
                Wait.Seconds(0.5);
            }
        }
示例#26
0
        public void Touch_Scroll_Horizontal()
        {
            WindowsElement homePagePivot       = session.FindElementByAccessibilityId("HomePagePivot");
            WindowsElement alarmPivotItem      = session.FindElementByAccessibilityId("AlarmPivotItem");
            WindowsElement worldClockPivotItem = session.FindElementByAccessibilityId("WorldClockPivotItem");

            Assert.IsNotNull(homePagePivot);
            Assert.IsNotNull(alarmPivotItem);
            Assert.IsNotNull(worldClockPivotItem);
            Assert.IsTrue(alarmPivotItem.Selected);
            Assert.IsFalse(worldClockPivotItem.Selected);

            // Perform scroll left touch action to switch from Alarm to WorldClock tab
            PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     sequence    = new ActionSequence(touchDevice, 0);

            sequence.AddAction(touchDevice.CreatePointerMove(homePagePivot, 0, 0, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerMove(homePagePivot, -session.Manage().Window.Size.Width / 2, 0, TimeSpan.FromSeconds(.5)));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });

            Thread.Sleep(TimeSpan.FromSeconds(1));
            Assert.IsFalse(alarmPivotItem.Selected);
            Assert.IsTrue(worldClockPivotItem.Selected);

            // Perform scroll right touch action to switch back from WorldClock to Alarm tab
            sequence = new ActionSequence(touchDevice, 0);
            sequence.AddAction(touchDevice.CreatePointerMove(homePagePivot, 0, 0, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerMove(homePagePivot, session.Manage().Window.Size.Width / 2, 0, TimeSpan.FromSeconds(.5)));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });

            Thread.Sleep(TimeSpan.FromSeconds(1));
            Assert.IsTrue(alarmPivotItem.Selected);
            Assert.IsFalse(worldClockPivotItem.Selected);
        }
示例#27
0
        public void Touch_Click_OriginViewport()
        {
            WindowsElement alarmPivotItem      = session.FindElementByAccessibilityId("AlarmPivotItem");
            WindowsElement worldClockPivotItem = session.FindElementByAccessibilityId("WorldClockPivotItem");
            int            x = worldClockPivotItem.Location.X; // x coordinate of UI element relative to application window
            int            y = worldClockPivotItem.Location.Y; // y coordinate of UI element relative to application window

            Assert.IsNotNull(alarmPivotItem);
            Assert.IsNotNull(worldClockPivotItem);
            Assert.IsTrue(alarmPivotItem.Selected);
            Assert.IsFalse(worldClockPivotItem.Selected);

            // Perform touch click action using viewport coordinate origin to switch from Alarm to WorldClock tab
            PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     sequence    = new ActionSequence(touchDevice, 0);

            sequence.AddAction(touchDevice.CreatePointerMove(CoordinateOrigin.Viewport, x, y, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });

            Thread.Sleep(TimeSpan.FromSeconds(1));
            Assert.IsFalse(alarmPivotItem.Selected);
            Assert.IsTrue(worldClockPivotItem.Selected);

            // Perform touch click action using viewport coordinate origin to switch from WorldClock to Alarm tab
            sequence = new ActionSequence(touchDevice, 0);
            x        = alarmPivotItem.Location.X;
            y        = alarmPivotItem.Location.Y;
            sequence.AddAction(touchDevice.CreatePointerMove(CoordinateOrigin.Viewport, x, y, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List <ActionSequence> {
                sequence
            });

            Thread.Sleep(TimeSpan.FromSeconds(1));
            Assert.IsTrue(alarmPivotItem.Selected);
            Assert.IsFalse(worldClockPivotItem.Selected);
        }
示例#28
0
 public void ActionsError_BadPointerTouch_Width_MissingHeight()
 {
     try
     {
         // Perform pen move action using a pointer width parameter value without providing the height
         PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
         ActionSequence     sequence    = new ActionSequence(touchDevice, 0);
         sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact, new TouchInfo {
             Width = 1f
         }));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.ActionsArgumentParameterMissingWidthOrHeight, exception.Message);
     }
 }
示例#29
0
 public void ActionsError_BadPointerTouch_Twist()
 {
     try
     {
         // Perform pen move action using a bad pointer twist parameter value
         PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
         ActionSequence     sequence    = new ActionSequence(touchDevice, 0);
         sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact, new TouchInfo {
             Twist = -1
         }));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.ActionsArgumentParameterTwist, exception.Message);
     }
 }
示例#30
0
 public void ActionsError_BadPointerPen_TiltY()
 {
     try
     {
         // Perform pen move action using a bad pointer tilt y parameter value
         PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
         ActionSequence     sequence  = new ActionSequence(penDevice, 0);
         sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact, new PenInfo {
             TiltY = 100
         }));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.ActionsArgumentParameterTiltY, exception.Message);
     }
 }