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