コード例 #1
0
        public void LongPressTestCase()
        {
            RequestProcessor re = setupTouchAction ();
            IWebElement element = driver.FindElementByIosUIAutomation (".elements()");

            ITouchAction a;

            a = new TouchAction (driver)
                .LongPress (element, 50, 75);
            a.Perform ();
            Assert.AreEqual (re.inputData, "{\"actions\":[{\"action\":\"longpress\",\"options\":{\"element\":\"5\",\"x\":50,\"y\":75}}]}");

            a = new TouchAction (driver)
                .LongPress (element, 0.5, 75);
            a.Perform ();
            Assert.AreEqual (re.inputData, "{\"actions\":[{\"action\":\"longpress\",\"options\":{\"element\":\"5\",\"x\":0.5,\"y\":75}}]}");

            a = new TouchAction (driver)
                .LongPress (0.5, 75);
            a.Perform ();
            Assert.AreEqual (re.inputData, "{\"actions\":[{\"action\":\"longpress\",\"options\":{\"x\":0.5,\"y\":75}}]}");

            a = new TouchAction (driver)
                .LongPress (element);
            a.Perform ();
            Assert.AreEqual (re.inputData, "{\"actions\":[{\"action\":\"longpress\",\"options\":{\"element\":\"5\"}}]}");
        }
コード例 #2
0
        public void MoveToTestCase()
        {
            IOSDriver<IWebElement> driver = new IOSDriver<IWebElement>(defaultUri, capabilities);
            RequestProcessor re = setupTouchAction();
            IWebElement element = driver.FindElementByIosUIAutomation(".elements()");

            ITouchAction a;

            a = new TouchAction(driver)
                .MoveTo(element, 50, 75);
            a.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"moveTo\",\"options\":{\"element\":\"5\",\"x\":50,\"y\":75}}]}");

            a = new TouchAction(driver)
                .MoveTo(element, 0.5, 75);
            a.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"moveTo\",\"options\":{\"element\":\"5\",\"x\":0.5,\"y\":75}}]}");

            a = new TouchAction(driver)
                .MoveTo(0.5, 75);
            a.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"moveTo\",\"options\":{\"x\":0.5,\"y\":75}}]}");

            a = new TouchAction(driver)
                .MoveTo(element);
            a.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"moveTo\",\"options\":{\"element\":\"5\"}}]}");
        }
コード例 #3
0
		public void SimpleActionTestCase ()
		{
			IWebElement el = driver.FindElementByAccessibilityId ("ComputeSumButton");
			ITouchAction action = new TouchAction(driver);
			action.Press(el, 10, 10).Release();
			action.Perform ();
		}
        public void CheckTap(IPerformsTouchActions performer)
        {
            TouchAction t = new TouchAction(performer);
            t.Tap(accessibility);
            t.Perform();

            MultiAction m = new MultiAction(performer);
            m.Add(new TouchAction(performer).Tap(customView));
            m.Add(new TouchAction(performer).Tap(clickable));
            m.Perform();
        }
コード例 #5
0
 public void SimpleActionTestCase()
 {
     driver.FindElementById ("TextField1").Clear();
     driver.FindElementById ("TextField1").SendKeys ("1");
     driver.FindElementById ("TextField2").Clear ();
     driver.FindElementById ("TextField2").SendKeys ("3");
     IWebElement el = driver.FindElementByAccessibilityId("ComputeSumButton");
     ITouchAction action = new TouchAction(driver);
     action.Press(el, 10, 10).Release();
     action.Perform();
     const string str = "4";
     Assert.AreEqual (driver.FindElementByXPath ("//*[@name = \"Answer\"]").Text, str);
 }
コード例 #6
0
        public void AppiumDriverPressMethod()
        {

            var elements = _driver.FindElementsByAndroidUIAutomator("new UiSelector().enabled(true)");
            var button = elements[11];

            TouchAction a1 = new TouchAction(_driver);
                a1
                  .Press(button)
                  .Wait(1000)
                  .Release();
                a1.Perform();

            elements = _driver.FindElementsByAndroidUIAutomator("new UiSelector().enabled(true)");
            var textV = elements[19];
            textV.SendKeys("495");

            Assert.AreEqual(textV.Text,495.ToString());
        }
コード例 #7
0
        public void WaitTestCase()
        {
            IOSDriver<IWebElement> driver = new IOSDriver<IWebElement>(defaultUri, capabilities);
            RequestProcessor re = setupTouchAction();
            ITouchAction a;

            a = new TouchAction(driver)
                .Wait(1000);
            a.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"wait\",\"options\":{\"ms\":1000}}]}");

            a = new TouchAction(driver)
                .Wait();
            a.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"wait\"}]}");
        }
コード例 #8
0
        public void ReleaseTestCase()
        {
            IOSDriver<IWebElement> driver = new IOSDriver<IWebElement>(defaultUri, capabilities);
            RequestProcessor re = setupTouchAction();
            ITouchAction a;

            a = new TouchAction(driver)
                .Release();
            a.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[{\"action\":\"release\"}]}");
        }
コード例 #9
0
        public void WaitTestCase()
        {
            RequestProcessor re = setupTouchAction ();
            ITouchAction a;

            a = new TouchAction (driver)
                .Wait (1000);
            a.Perform ();
            Assert.AreEqual (re.inputData, "{\"actions\":[{\"action\":\"wait\",\"options\":{\"ms\":1000}}]}");

            a = new TouchAction (driver)
                .Wait ();
            a.Perform ();
            Assert.AreEqual (re.inputData, "{\"actions\":[{\"action\":\"wait\"}]}");
        }
コード例 #10
0
        public void ReleaseTestCase()
        {
            RequestProcessor re = setupTouchAction ();
            ITouchAction a;

            a = new TouchAction (driver)
                .Release ();
            a.Perform ();
            Assert.AreEqual (re.inputData, "{\"actions\":[{\"action\":\"release\"}]}");
        }
コード例 #11
0
 private void performTouch(AndroidElement element)
 {
     if (element != null)
     {
         TouchAction a1 = new TouchAction(driver);
         a1
           .Press(element, 100, 100)
           .Wait(1000)
           .Release();
         a1.Perform();
     }
 }