1f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin/* 2f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * Copyright (C) 2013 DroidDriver committers 3f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * 4f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * Licensed under the Apache License, Version 2.0 (the "License"); 5f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * you may not use this file except in compliance with the License. 6f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * You may obtain a copy of the License at 7f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * 8f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * http://www.apache.org/licenses/LICENSE-2.0 9f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * 10f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * Unless required by applicable law or agreed to in writing, software 11f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * distributed under the License is distributed on an "AS IS" BASIS, 12f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * See the License for the specific language governing permissions and 14f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * limitations under the License. 15f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin */ 16f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jinpackage com.google.android.droiddriver.scroll; 17f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin 18f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jinimport com.google.android.droiddriver.DroidDriver; 19f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jinimport com.google.android.droiddriver.UiElement; 20f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jinimport com.google.android.droiddriver.actions.ScrollDirection; 21f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jinimport com.google.android.droiddriver.exceptions.ElementNotFoundException; 22f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jinimport com.google.android.droiddriver.finders.Finder; 23f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin 24f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin/** 25f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * Interface for scrolling to the desired child in a scrollable parent view. 26f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin */ 27f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jinpublic interface Scroller { 28f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin /** 29f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * Scrolls {@code parentFinder} in both directions if necessary to find 30f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * {@code childFinder}. 31f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * 32f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @param driver 33f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @param parentFinder Finder for the container that can scroll, for instance 34f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * a ListView 35f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @param childFinder Finder for the desired child; relative to 36f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * {@code parentFinder} 37f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @return the UiElement matching {@code childFinder} 38f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @throws ElementNotFoundException If no match is found 39f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin */ 40f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin UiElement scrollTo(DroidDriver driver, Finder parentFinder, Finder childFinder); 41f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin 42f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin /** 43f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * Scrolls {@code parentFinder} in {@code direction} if necessary to find 44f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * {@code childFinder}. 45f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * 46f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @param driver 47f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @param parentFinder Finder for the container that can scroll, for instance 48f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * a ListView 49f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @param childFinder Finder for the desired child; relative to 50f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * {@code parentFinder} 51f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @param direction 52f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @return the UiElement matching {@code childFinder} 53f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin * @throws ElementNotFoundException If no match is found 54f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin */ 55f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin UiElement scrollTo(DroidDriver driver, Finder parentFinder, Finder childFinder, 56f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin ScrollDirection direction); 57f9c6c5063b38b623679e47d7095cccddb0481319Kevin Jin} 58