How to use scroll method of com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils class

Best Carina code snippet using com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils.scroll

Source:IAndroidUtils.java Github

copy

Full Screen

...278 * Scrolls into view in specified container by text only and return boolean279 *280 * @param container281 * ExtendedWebElement - defaults to id Selector Type282 * @param scrollToElement283 * String defaults to text Selector Type284 * @return ExtendedWebElement285 * <p>286 * example of usage: ExtendedWebElement res =287 * AndroidUtils.scroll("News", newsListContainer);288 **/289 default public ExtendedWebElement scroll(String scrollToElement, ExtendedWebElement container) {290 return scroll(scrollToElement, container, SelectorType.ID, SelectorType.TEXT);291 }292 /**293 * Scrolls into view in a container specified by it's instance (index)294 * 295 * @param scrollToEle296 * - has to be id, text, contentDesc or className297 * @param scrollableContainer298 * - ExtendedWebElement type299 * @param containerSelectorType300 * - has to be id, text, textContains, textStartsWith, Description,301 * DescriptionContains or className302 * @param containerInstance303 * - has to an instance number of desired container304 * @param eleSelectorType305 * - has to be id, text, textContains, textStartsWith, Description,306 * DescriptionContains or className307 * @return ExtendedWebElement308 * <p>309 * example of usage: ExtendedWebElement res =310 * AndroidUtils.scroll("News", newsListContainer,311 * AndroidUtils.SelectorType.CLASS_NAME, 1,312 * AndroidUtils.SelectorType.TEXT);313 **/314 default public ExtendedWebElement scroll(String scrollToEle, ExtendedWebElement scrollableContainer,315 SelectorType containerSelectorType, int containerInstance, SelectorType eleSelectorType) {316 ExtendedWebElement extendedWebElement = null;317 long startTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());318 // TODO: support multi threaded WebDriver's removing DriverPool usage319 WebDriver drv = castDriver();320 // workaorund for appium issue: https://github.com/appium/appium/issues/10159321 if (scrollToEle.contains(",")) {322 scrollToEle = StringUtils.join(StringUtils.split(scrollToEle, ","), ",", 0, 2);323 if (eleSelectorType.equals(SelectorType.TEXT)) {324 eleSelectorType = SelectorType.TEXT_CONTAINS;325 }326 }327 for (int i = 0; i < SCROLL_MAX_SEARCH_SWIPES; i++) {328 try {329 By scrollBy = MobileBy.AndroidUIAutomator("new UiScrollable("330 + getScrollContainerSelector(scrollableContainer, containerSelectorType) + ".instance("331 + containerInstance + "))" + ".setMaxSearchSwipes(" + SCROLL_MAX_SEARCH_SWIPES + ")"332 + ".scrollIntoView(" + getScrollToElementSelector(scrollToEle, eleSelectorType) + ")");333 WebElement ele = drv.findElement(scrollBy);334 if (ele.isDisplayed()) {335 UTILS_LOGGER.info("Element found!!!");336 // initializing with driver context because scrollBy consists from container and element selectors337 extendedWebElement = new ExtendedWebElement(scrollBy, scrollToEle, drv, drv);338 break;339 }340 } catch (NoSuchElementException noSuchElement) {341 UTILS_LOGGER.error(String.format("%s %s:%s", SpecialKeywords.NO_SUCH_ELEMENT_ERROR, eleSelectorType, scrollToEle),342 noSuchElement);343 }344 for (int j = 0; j < i; j++) {345 checkTimeout(startTime);346 MobileBy.AndroidUIAutomator(347 "new UiScrollable(" + getScrollContainerSelector(scrollableContainer, containerSelectorType)348 + ".instance(" + containerInstance + ")).scrollForward()");349 UTILS_LOGGER.info("Scroller got stuck on a page, scrolling forward to next page of elements..");350 }351 }352 return extendedWebElement;353 }354 /**355 * Scrolls into view in specified container356 * 357 * @param scrollToEle358 * - has to be id, text, contentDesc or className359 * @param scrollableContainer360 * - ExtendedWebElement type361 * @param containerSelectorType362 * - has to be id, text, textContains, textStartsWith, Description,363 * DescriptionContains or className364 * @param containerInstance365 * - has to an instance number of desired container366 * @param eleSelectorType367 * - has to be id, text, textContains, textStartsWith, Description,368 * DescriptionContains or className369 * @param eleSelectorInstance370 * - has to an instance number of desired container371 * @return ExtendedWebElement372 * <p>373 * example of usage: ExtendedWebElement res =374 * AndroidUtils.scroll("News", newsListContainer,375 * AndroidUtils.SelectorType.CLASS_NAME, 1,376 * AndroidUtils.SelectorType.TEXT, 2);377 **/378 default public ExtendedWebElement scroll(String scrollToEle, ExtendedWebElement scrollableContainer,379 SelectorType containerSelectorType, int containerInstance, SelectorType eleSelectorType,380 int eleSelectorInstance) {381 ExtendedWebElement extendedWebElement = null;382 long startTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());383 // TODO: support multi threaded WebDriver's removing DriverPool usage384 WebDriver drv = castDriver();385 // workaorund for appium issue: https://github.com/appium/appium/issues/10159386 if (scrollToEle.contains(",")) {387 scrollToEle = StringUtils.join(StringUtils.split(scrollToEle, ","), ",", 0, 2);388 if (eleSelectorType.equals(SelectorType.TEXT)) {389 eleSelectorType = SelectorType.TEXT_CONTAINS;390 }391 }392 for (int i = 0; i < SCROLL_MAX_SEARCH_SWIPES; i++) {393 try {394 By scrollBy = MobileBy.AndroidUIAutomator("new UiScrollable("395 + getScrollContainerSelector(scrollableContainer, containerSelectorType) + ".instance("396 + containerInstance + "))" + ".setMaxSearchSwipes(" + SCROLL_MAX_SEARCH_SWIPES + ")"397 + ".scrollIntoView(" + getScrollToElementSelector(scrollToEle, eleSelectorType) + ".instance("398 + eleSelectorInstance + "))");399 WebElement ele = drv.findElement(scrollBy);400 if (ele.isDisplayed()) {401 UTILS_LOGGER.info("Element found!!!");402 // initializing with driver context because scrollBy consists from container and element selectors403 extendedWebElement = new ExtendedWebElement(scrollBy, scrollToEle, drv, drv);404 break;405 }406 } catch (NoSuchElementException noSuchElement) {407 UTILS_LOGGER.error(String.format("%s%s:%s", SpecialKeywords.NO_SUCH_ELEMENT_ERROR, eleSelectorType, scrollToEle),408 noSuchElement);409 }410 for (int j = 0; j < i; j++) {411 checkTimeout(startTime);412 MobileBy.AndroidUIAutomator(413 "new UiScrollable(" + getScrollContainerSelector(scrollableContainer, containerSelectorType)414 + ".instance(" + containerInstance + ")).scrollForward()");415 UTILS_LOGGER.info("Scroller got stuck on a page, scrolling forward to next page of elements..");416 }417 }418 return extendedWebElement;419 }420 /**421 * Scrolls into view in specified container422 * 423 * @param scrollToEle424 * - has to be id, text, contentDesc or className425 * @param scrollableContainer426 * - ExtendedWebElement type427 * @param containerSelectorType428 * - container Selector type: has to be id, text, textContains,429 * textStartsWith, Description, DescriptionContains or className430 * @param eleSelectorType431 * - scrollToEle Selector type: has to be id, text, textContains,432 * textStartsWith, Description, DescriptionContains or className433 * @return ExtendedWebElement434 * <p>435 * example of usage: ExtendedWebElement res =436 * AndroidUtils.scroll("News", newsListContainer,437 * AndroidUtils.SelectorType.CLASS_NAME,438 * AndroidUtils.SelectorType.TEXT);439 **/440 default public ExtendedWebElement scroll(String scrollToEle, ExtendedWebElement scrollableContainer,441 SelectorType containerSelectorType, SelectorType eleSelectorType) {442 ExtendedWebElement extendedWebElement = null;443 long startTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());444 // TODO: support multi threaded WebDriver's removing DriverPool usage445 WebDriver drv = castDriver();446 // workaorund for appium issue: https://github.com/appium/appium/issues/10159447 if (scrollToEle.contains(",")) {448 scrollToEle = StringUtils.join(StringUtils.split(scrollToEle, ","), ",", 0, 2);449 if (eleSelectorType.equals(SelectorType.TEXT)) {450 eleSelectorType = SelectorType.TEXT_CONTAINS;451 }452 }453 for (int i = 0; i < SCROLL_MAX_SEARCH_SWIPES; i++) {454 try {455 By scrollBy = MobileBy.AndroidUIAutomator(456 "new UiScrollable(" + getScrollContainerSelector(scrollableContainer, containerSelectorType)457 + ")" + ".setMaxSearchSwipes(" + SCROLL_MAX_SEARCH_SWIPES + ")" + ".scrollIntoView("458 + getScrollToElementSelector(scrollToEle, eleSelectorType) + ")");459 WebElement ele = drv.findElement(scrollBy);460 if (ele.isDisplayed()) {461 UTILS_LOGGER.info("Element found!!!");462 // initializing with driver context because scrollBy consists from container and element selectors463 extendedWebElement = new ExtendedWebElement(scrollBy, scrollToEle, drv, drv);464 break;465 }466 } catch (NoSuchElementException noSuchElement) {467 UTILS_LOGGER.error(String.format("%s%s:%s", SpecialKeywords.NO_SUCH_ELEMENT_ERROR, eleSelectorType, scrollToEle),468 noSuchElement);469 }470 for (int j = 0; j < i; j++) {471 checkTimeout(startTime);472 MobileBy.AndroidUIAutomator("new UiScrollable("473 + getScrollContainerSelector(scrollableContainer, containerSelectorType) + ").scrollForward()");474 UTILS_LOGGER.info("Scroller got stuck on a page, scrolling forward to next page of elements..");475 }476 }477 return extendedWebElement;478 }479 /**480 * Scrolls into view in specified container481 * 482 * @param scrollableContainer483 * - ExtendedWebElement type484 * @param containerSelectorType485 * - Selector type: has to be id, text, contentDesc or className486 * @return scrollViewContainerFinder String487 *488 **/489 default String getScrollContainerSelector(ExtendedWebElement scrollableContainer,490 SelectorType containerSelectorType) {491 UTILS_LOGGER.debug(scrollableContainer.getBy().toString());492 String scrollableContainerBy;493 String scrollViewContainerFinder = "";494 switch (containerSelectorType) {495 case TEXT:496 scrollableContainerBy = scrollableContainer.getBy().toString().replace("By.text:", "").trim();497 scrollViewContainerFinder = "new UiSelector().text(\"" + scrollableContainerBy + "\")";498 break;499 case TEXT_CONTAINS:500 scrollableContainerBy = scrollableContainer.getBy().toString().replace("By.textContains:", "").trim();501 scrollViewContainerFinder = "new UiSelector().textContains(\"" + scrollableContainerBy + "\")";502 break;503 case TEXT_STARTS_WITH:504 scrollableContainerBy = scrollableContainer.getBy().toString().replace("By.textStartsWith:", "").trim();505 scrollViewContainerFinder = "new UiSelector().textStartsWith(\"" + scrollableContainerBy + "\")";506 break;507 case ID:508 scrollableContainerBy = scrollableContainer.getBy().toString().replace("By.id:", "").trim();509 scrollViewContainerFinder = "new UiSelector().resourceId(\"" + scrollableContainerBy + "\")";510 break;511 case DESCRIPTION:512 scrollableContainerBy = scrollableContainer.getBy().toString().replace("By.description:", "").trim();513 scrollViewContainerFinder = "new UiSelector().description(\"" + scrollableContainerBy + "\")";514 break;515 case DESCRIPTION_CONTAINS:516 scrollableContainerBy = scrollableContainer.getBy().toString().replace("By.descriptionContains:", "")517 .trim();518 scrollViewContainerFinder = "new UiSelector().descriptionContains(\"" + scrollableContainerBy + "\")";519 break;520 case CLASS_NAME:521 scrollableContainerBy = scrollableContainer.getBy().toString().replace("By.className:", "").trim();522 scrollViewContainerFinder = "new UiSelector().className(\"" + scrollableContainerBy + "\")";523 break;524 default:525 UTILS_LOGGER.info("Please provide valid selectorType for element to be found...");526 break;527 }528 return scrollViewContainerFinder;529 }530 /**531 * Scrolls into view in specified container532 * 533 * @param scrollToEle534 * - String type535 * @param eleSelectorType536 * - Selector type: has to be id, text, contentDesc or className537 * @return String538 **/539 default String getScrollToElementSelector(String scrollToEle, SelectorType eleSelectorType) {540 String neededElementFinder = "";541 String scrollToEleTrimmed;542 switch (eleSelectorType) {543 case TEXT:544 neededElementFinder = "new UiSelector().text(\"" + scrollToEle + "\")";545 break;546 case TEXT_CONTAINS:547 neededElementFinder = "new UiSelector().textContains(\"" + scrollToEle + "\")";548 break;549 case TEXT_STARTS_WITH:550 neededElementFinder = "new UiSelector().textStartsWith(\"" + scrollToEle + "\")";551 break;552 case ID:553 scrollToEleTrimmed = scrollToEle.replace("By.id:", "").trim();554 neededElementFinder = "new UiSelector().resourceId(\"" + scrollToEleTrimmed + "\")";555 break;556 case DESCRIPTION:557 neededElementFinder = "new UiSelector().description(\"" + scrollToEle + "\")";558 break;559 case DESCRIPTION_CONTAINS:560 neededElementFinder = "new UiSelector().descriptionContains(\"" + scrollToEle + "\")";561 break;562 case CLASS_NAME:563 scrollToEleTrimmed = scrollToEle.replace("By.className:", "").trim();564 neededElementFinder = "new UiSelector().className(\"" + scrollToEleTrimmed + "\")";565 break;566 default:567 UTILS_LOGGER.info("Please provide valid selectorType for element to be found...");568 break;569 }570 return neededElementFinder;571 }572 /**573 * Scroll Timeout check574 * 575 * @param startTime576 * - Long initial time for timeout count down577 **/578 default public void checkTimeout(long startTime) {...

Full Screen

Full Screen

Source:DateTimeSettingsPage.java Github

copy

Full Screen

...42 }43 @FindBy(xpath = "//android.widget.TextView[@text = 'Select time zone']")44 protected ExtendedWebElement selectTimeZone;45 @FindBy(xpath = "//android.widget.ListView")46 protected ExtendedWebElement scrollableContainer;47 @FindBy(id = "com.android.settings:id/recycler_view")48 protected ExtendedWebElement scrollableContainerInVersion8_1;49 @FindBy(className = "android.widget.ListView")50 protected ExtendedWebElement scrollableContainerByClassName;51 @FindBy(xpath = "//android.widget.TextView[contains(@text,'%s')]")52 protected ExtendedWebElement tzSelectionBase;53 @FindBy(id = "com.android.settings:id/next_button")54 protected ExtendedWebElement nextButton;55 protected static final String SELECT_TIME_ZONE_TEXT = "Select time zone";56 /**57 * openTimeZoneSetting58 */59 public void openTimeZoneSetting() {60 boolean found = selectTimeZone.clickIfPresent(SHORT_TIMEOUT);61 if (!found) {62 boolean scrolled = scroll(SELECT_TIME_ZONE_TEXT, scrollableContainerByClassName,63 SelectorType.CLASS_NAME, SelectorType.TEXT).isElementPresent();64 if (scrolled) {65 found = selectTimeZone.clickIfPresent(SHORT_TIMEOUT);66 } else {67 throw new RuntimeException("Desired Time Zone Menu item not found.. ");68 }69 }70 LOGGER.info("Select Time Zone Menu item was clicked: " + found);71 }72 /**73 * selectTimeZone74 *75 * @param tz String76 * @param timezone String77 * @param tzGMT String78 * @return boolean79 */80 public boolean selectTimeZone(String tz, String timezone, String tzGMT) {81 boolean selected = false;82 String deviceOsFullVersion = IDriverPool.getDefaultDevice().getOsVersion();83 int deviceOsVersion;84 //Adding extra step required to get to TimeZone screen on devices running versions > 885 if (deviceOsFullVersion.contains(".")) {86 deviceOsVersion = Integer.valueOf(deviceOsFullVersion.split("\\.")[0]);87 } else {88 deviceOsVersion = Integer.valueOf(deviceOsFullVersion);89 }90 //if device OS version >= 9, we have to set Country Region and obtain city from timeZone91 setupTimezoneRegion(timezone, deviceOsVersion);92 tz = tz.split("/")[1].replace("_", " ");93 //locating timeZone by City94 if (!tz.isEmpty() && locateTimeZoneByCity(tz, deviceOsVersion)) {95 tzSelectionBase.format(tz).click();96 selected = true;97 }98 //locating timeZone by GMT99 if (!selected && locateTimeZoneByGMT(tzGMT, deviceOsVersion)) {100 tzSelectionBase.format(tzGMT).click();101 selected = true;102 }103 return selected;104 }105 /**106 * setup timezone region (this method is responsible for setting up timezone region, req. for OS version &gt; 8)107 *108 * @param timezoneRegion String109 * @param deviceOsVersion int110 */111 private void setupTimezoneRegion(String timezoneRegion, int deviceOsVersion){112 if (deviceOsVersion >= 9) {113 LOGGER.info("Detected Android version 8 or above, selecting country region for 'Time Zone' option..");114 timeZoneRegionOption.clickIfPresent();115 timeZoneRegionSearchInputField.type(timezoneRegion);116 timeZoneRegionSearchResult.format(timezoneRegion).click();117 }118 }119 /**120 * selectTimezoneByGMT121 *122 * @param tzGMT String123 * @param deviceOsVersion int124 * @return boolean125 */126 private boolean locateTimeZoneByGMT(String tzGMT, int deviceOsVersion){127 LOGGER.info("Searching for tz by GTM: " + tzGMT);128 boolean result = false;129 if (deviceOsVersion > 8) {130 try {131 result = scroll(tzGMT, scrollableContainerInVersion8_1,132 SelectorType.ID, SelectorType.TEXT_CONTAINS).isElementPresent();133 } catch (NoSuchElementException e){134 e.printStackTrace();135 result = false;136 }137 } else {138 try {139 result = scroll(tzGMT, scrollableContainerByClassName,140 SelectorType.CLASS_NAME, SelectorType.TEXT_CONTAINS).isElementPresent();141 } catch (NoSuchElementException e){142 e.printStackTrace();143 result = false;144 }145 }146 return result;147 }148 /**149 * selectTimezoneByCity150 *151 * @param tz String152 * @param deviceOsVersion int153 * @return boolean154 */155 private boolean locateTimeZoneByCity(String tz, int deviceOsVersion){156 LOGGER.info("Searching for tz by City: " + tz);157 boolean result = false;158 if (deviceOsVersion > 8) {159 try {160 result = scroll(tz, scrollableContainerInVersion8_1,161 SelectorType.ID, SelectorType.TEXT_CONTAINS).isElementPresent();162 } catch (NoSuchElementException e){163 e.printStackTrace();164 result = false;165 }166 } else {167 try {168 result = scroll(tz, scrollableContainerByClassName,169 SelectorType.CLASS_NAME, SelectorType.TEXT_CONTAINS).isElementPresent();170 } catch (NoSuchElementException e){171 e.printStackTrace();172 result = false;173 }174 }175 return result;176 }177 /**178 * clickNextButton179 *180 * @return boolean181 */182 public boolean clickNextButton() {...

Full Screen

Full Screen

scroll

Using AI Code Generation

copy

Full Screen

1package com.qaprosoft.carina.demo;2import org.openqa.selenium.By;3import org.openqa.selenium.WebDriver;4import org.openqa.selenium.WebElement;5import org.openqa.selenium.support.FindBy;6import org.openqa.selenium.support.PageFactory;7import org.testng.Assert;8import org.testng.annotations.Test;9import com.qaprosoft.carina.core.foundation.AbstractTest;10import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;11public class AndroidUtilsScrollTest extends AbstractTest {12 private WebElement views;13 private WebElement dateWidgets;14 private WebElement inline;15 private WebElement nine;16 private WebElement fifteen;17 private WebElement twenty;18 private WebElement twentyFive;19 private WebElement thirty;20 private WebElement thirtyFive;21 private WebElement forty;22 private WebElement fortyFive;23 private WebElement fifty;24 private WebElement fiftyFive;25 private WebElement sixty;26 public AndroidUtilsScrollTest() {27 PageFactory.initElements(getDriver(), this);28 }29 public void testAndroidUtilsScroll() {30 WebDriver driver = getDriver();31 IAndroidUtils androidUtils = (IAndroidUtils) driver;32 views.click();33 dateWidgets.click();34 inline.click();35 androidUtils.scroll(1, 0.5, 0.1, 2000);36 Assert.assertTrue(nine.isDisplayed(), "9 is not displayed");37 androidUtils.scroll(1, 0.5, 0.1, 2000);38 Assert.assertTrue(fifteen.isDisplayed(), "

Full Screen

Full Screen

scroll

Using AI Code Generation

copy

Full Screen

1package com.qaprosoft.carina.demo;2import org.openqa.selenium.By;3import org.openqa.selenium.WebDriver;4import org.openqa.selenium.WebElement;5import org.openqa.selenium.remote.RemoteWebDriver;6import org.testng.Assert;7import org.testng.annotations.Test;8import com.qaprosoft.carina.core.foundation.webdriver.DriverHelper;9import com.qaprosoft.carina.core.foundation.webdriver.decorator.ExtendedWebElement;10import com.qaprosoft.carina.core.foundation.webdriver.decorator.PageOpeningStrategy;11import com.qaprosoft.carina.core.foundation.webdriver.decorator.WebDriverAugmenter;12import com.qaprosoft.carina.demo.gui.pages.common.HomeBasePage;13import com.qaprosoft.carina.demo.gui.pages.common.LoginPageBase;14import com.qaprosoft.carina.demo.gui.pages.common.LoginPageBase.LoginPageBaseOpenStrategy;15import com.qaprosoft.carina.demo.gui.pages.common.LoginPageBase.LoginPageBaseOpenStrategy.LoginPageBaseOpenStrategyType;16import com.qaprosoft.carina.demo.gui.pages.common.LoginPageBase.LoginPageBaseOpenStrategy.LoginPageBaseOpenStrategyType.LoginPageBaseOpenStrategyTypeType;17import com.qaprosoft.carina.demo.gui.pages.common.LoginPageBase.LoginPageBaseOpenStrategy.LoginPageBaseOpenStrategyType.LoginPageBaseOpenStrategyTypeType.LoginPageBaseOpenStrategyTypeTypeType;18import com.qaprosoft.carina.demo.gui.pages.common.LoginPageBase.LoginPageBaseOpenStrategy.LoginPageBaseOpenStrategyType.LoginPageBaseOpenStrategyTypeType.LoginPageBaseOpenStrategyTypeTypeType.LoginPageBaseOpenStrategyTypeTypeTypeType;19import com.qaprosoft.carina.demo.gui.pages.common.LoginPageBase.LoginPageBaseOpenStrategy.LoginPageBaseOpenStrategyType.LoginPageBaseOpenStrategyTypeType.LoginPageBaseOpenStrategyTypeTypeType.LoginPageBaseOpenStrategyTypeTypeTypeType.LoginPageBaseOpenStrategyTypeTypeTypeTypeType;20import com.qaprosoft.carina.demo.gui.pages.common.LoginPageBase.LoginPageBaseOpenStrategy.LoginPageBaseOpenStrategyType.LoginPageBaseOpenStrategyTypeType.LoginPageBaseOpenStrategyTypeTypeType.LoginPageBaseOpenStrategyTypeTypeTypeType.LoginPageBaseOpenStrategyTypeTypeTypeTypeType.LoginPageBaseOpenStrategyTypeTypeTypeTypeTypeTypeType;21import com.qaprosoft.carina.demo.gui.pages.common.LoginPageBase.LoginPageBaseOpenStrategy.LoginPageBaseOpenStrategyType.LoginPageBaseOpenStrategyTypeType.LoginPageBaseOpenStrategyTypeTypeType.LoginPageBaseOpenStrategyTypeTypeTypeType.LoginPageBaseOpenStrategyTypeTypeTypeType

Full Screen

Full Screen

scroll

Using AI Code Generation

copy

Full Screen

1package com.qaprosoft.carina.demo.gui.android;2import org.openqa.selenium.By;3import org.openqa.selenium.WebElement;4import org.openqa.selenium.support.FindBy;5import org.testng.Assert;6import org.testng.annotations.Test;7import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;8import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils.Direction;9import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils.ScrollStrategy;10import com.qaprosoft.carina.core.foundation.utils.factory.DeviceType;11import com.qaprosoft.carina.core.foundation.webdriver.decorator.ExtendedWebElement;12import com.qaprosoft.carina.demo.gui.common.CarinaDescriptionPageBase;13import com.qaprosoft.carina.demo.gui.common.CarinaDescriptionPageBase;14@DeviceType(pageType = DeviceType.Type.ANDROID_PHONE, parentClass = CarinaDescriptionPageBase.class)15public class CarinaDescriptionPage extends CarinaDescriptionPageBase {16 private ExtendedWebElement carinaDescription;17 private ExtendedWebElement carinaDescription;18 public boolean isPageOpened() {19 return carinaDescription.isElementPresent();20 }21 public boolean isPageOpened() {22 return carinaDescription.isElementPresent();23 }24 public void scrollTest() {25 IAndroidUtils androidUtils = (IAndroidUtils) getDriver();26 androidUtils.scroll(Direction.DOWN, ScrollStrategy.AUTO);27 Assert.assertTrue(carinaDescription.isElementPresent());28 }29 public void scrollTest() {30 IAndroidUtils androidUtils = (IAndroidUtils) getDriver();31 androidUtils.scroll(Direction.DOWN, ScrollStrategy.AUTO);32 Assert.assertTrue(carinaDescription.isElementPresent());33 }34 public void scrollTest() {35 IAndroidUtils androidUtils = (IAndroidUtils) getDriver();36 androidUtils.scroll(Direction.DOWN, ScrollStrategy.AUTO);37 Assert.assertTrue(carinaDescription.isElementPresent());38 }39 public void scrollTest() {40 IAndroidUtils androidUtils = (IAndroidUtils) getDriver();41 androidUtils.scroll(Direction.DOWN, ScrollStrategy.AUTO);42 Assert.assertTrue(carinaDescription.isElementPresent());43 }44 public void scrollTest() {45 IAndroidUtils androidUtils = (IAndroid

Full Screen

Full Screen

scroll

Using AI Code Generation

copy

Full Screen

1package com.qaprosoft.carina.demo;2import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;3import io.appium.java_client.AppiumDriver;4import io.appium.java_client.MobileElement;5public class DemoAndroidUtils extends IAndroidUtils {6public DemoAndroidUtils(AppiumDriver<MobileElement> driver) {7super(driver);8}9public void scrollDown() {10scroll("down");11}12public void scrollUp() {13scroll("up");14}15}16package com.qaprosoft.carina.demo;17import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;18import io.appium.java_client.AppiumDriver;19import io.appium.java_client.MobileElement;20public class DemoAndroidUtils extends IAndroidUtils {21public DemoAndroidUtils(AppiumDriver<MobileElement> driver) {22super(driver);23}24public void swipeRight() {25swipe("right");26}27public void swipeLeft() {28swipe("left");29}30}31package com.qaprosoft.carina.demo;32import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;33import io.appium.java_client.AppiumDriver;34import io.appium.java_client.MobileElement;35public class DemoAndroidUtils extends IAndroidUtils {36public DemoAndroidUtils(AppiumDriver<MobileElement> driver) {37super(driver);38}39public void swipeRight() {40swipe("right");41}42public void swipeLeft() {43swipe("left");44}45}46package com.qaprosoft.carina.demo;47import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;48import io.appium.java_client.AppiumDriver;49import io.appium.java_client.MobileElement;50public class DemoAndroidUtils extends IAndroidUtils {51public DemoAndroidUtils(AppiumDriver<MobileElement> driver) {52super(driver);53}54public void swipeRight() {55swipe("right");56}57public void swipeLeft() {58swipe("left");59}60}

Full Screen

Full Screen

scroll

Using AI Code Generation

copy

Full Screen

1package com.test;2import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;3import com.qaprosoft.carina.core.foundation.webdriver.DriverHelper;4import com.qaprosoft.carina.core.foundation.webdriver.decorator.ExtendedWebElement;5import org.openqa.selenium.By;6import org.openqa.selenium.WebDriver;7import org.openqa.selenium.support.FindBy;8public class Test extends DriverHelper {9private ExtendedWebElement accessibility;10public Test(WebDriver driver) {11super(driver);12}13public void testMethod() {14accessibility.click();15IAndroidUtils.scroll(driver, "Views");16}17}18package com.test;19import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;20import com.qaprosoft.carina.core.foundation.webdriver.DriverHelper;21import com.qaprosoft.carina.core.foundation.webdriver.decorator.ExtendedWebElement;22import org.openqa.selenium.By;23import org.openqa.selenium.WebDriver;24import org.openqa.selenium.support.FindBy;25public class Test extends DriverHelper {26private ExtendedWebElement accessibility;27public Test(WebDriver driver) {28super(driver);29}30public void testMethod() {31accessibility.click();32IAndroidUtils.scroll(driver, "Views");33}34}35package com.test;36import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;37import com.qaprosoft.carina.core.foundation.webdriver.DriverHelper;38import com.qaprosoft.carina.core.foundation.webdriver.decorator.ExtendedWebElement;39import org.openqa.selenium.By;40import org.openqa.selenium.WebDriver;41import org.openqa.selenium.support.FindBy;42public class Test extends DriverHelper {43private ExtendedWebElement accessibility;44public Test(WebDriver driver) {45super(driver);46}47public void testMethod() {48accessibility.click();49IAndroidUtils.scroll(driver, "Views");50}51}52package com.test;53import com.qaprosoft.carina.core.foundation.utils.android.IAndroidUtils;54import com.q

Full Screen

Full Screen

scroll

Using AI Code Generation

copy

Full Screen

1package com.qaprosoft.carina.core.foundation.utils.android;2import org.openqa.selenium.By;3import org.openqa.selenium.Dimension;4import org.openqa.selenium.Point;5import org.openqa.selenium.WebElement;6import org.openqa.selenium.remote.RemoteWebDriver;7import com.qaprosoft.carina.core.foundation.utils.R;8import com.qaprosoft.carina.core.foundation.utils.mobile.IMobileUtils;9import com.qaprosoft.carina.core.foundation.utils.mobile.MobileUtils;10import com.qaprosoft.carina.core.foundation.webdriver.DriverPool;11import com.qaprosoft.carina.core.foundation.webdriver.decorator.ExtendedWebElement;12import io.appium.java_client.MobileBy;13import io.appium.java_client.MobileElement;14import io.appium.java_client.TouchAction;15import io.appium.java_client.android.AndroidDriver;16import io.appium.java_client.android.AndroidKeyCode;17import io.appium.java_client.android.AndroidTouchAction;18import io.appium.java_client.android.nativekey.AndroidKey;19import io.appium.java_client.android.nativekey.KeyEvent;20import io.appium.java_client.ios.IOSDriver;21import io.appium.java_client.ios.IOSTouchAction;22import io.appium.java_client.touch.WaitOptions;23import io.appium.java_client.touch.offset.PointOption;24import java.time.Duration;25import java.util.ArrayList;26import java.util.List;27import org.apache.log4j.Logger;28import org.openqa.selenium.By;29import org.openqa.selenium.Dimension;30import org.openqa.selenium.Point;31import org.openqa.selenium.WebElement;32import org.openqa.selenium.remote.RemoteWebDriver;33import com.qaprosoft.carina.core.foundation.utils.R;34import com.qaprosoft.carina.core.foundation.utils.mobile.IMobileUtils;35import com.qaprosoft.carina.core.foundation.utils.mobile.MobileUtils;36import com.qaprosoft.carina.core.foundation.webdriver.DriverPool;

Full Screen

Full Screen

scroll

Using AI Code Generation

copy

Full Screen

1 public void scroll(String text) {2 IAndroidUtils androidUtils = (IAndroidUtils) getAndroidUtils();3 androidUtils.scroll(text);4 }5}6 public void swipe(String direction, int duration) {7 IAndroidUtils androidUtils = (IAndroidUtils) getAndroidUtils();8 androidUtils.swipe(direction, duration);9 }10}11 public void swipe(String direction, int duration) {12 IAndroidUtils androidUtils = (IAndroidUtils) getAndroidUtils();13 androidUtils.swipe(direction, duration);14 }15}16 public void swipe(String direction, int duration) {17 IAndroidUtils androidUtils = (IAndroidUtils) getAndroidUtils();18 androidUtils.swipe(direction, duration);19 }20}21 public void swipe(String direction, int duration) {22 IAndroidUtils androidUtils = (IAndroidUtils) getAndroidUtils();23 androidUtils.swipe(direction, duration);24 }25}26 public void swipe(String direction, int duration) {27 IAndroidUtils androidUtils = (IAndroidUtils) getAndroidUtils();28 androidUtils.swipe(direction, duration);29 }30}31 public void swipe(String direction, int duration) {32 IAndroidUtils androidUtils = (IAndroidUtils) getAndroidUtils();33 androidUtils.swipe(direction, duration);34 }35}36 public void swipe(String direction, int duration) {37 IAndroidUtils androidUtils = (IAndroidUtils) getAndroidUtils();38 androidUtils.swipe(direction, duration);39 }40}41 public void swipe(String direction, int duration) {

Full Screen

Full Screen

scroll

Using AI Code Generation

copy

Full Screen

1 public void testAndroidScroll() {2 IAndroidUtils androidUtils = AndroidUtils.getAndroidUtils();3 androidUtils.scroll("text", "Views");4 }5 public void testAndroidSwipe() {6 IAndroidUtils androidUtils = AndroidUtils.getAndroidUtils();7 androidUtils.swipe("text", "Views");8 }9 public void testAndroidSwipe1() {10 IAndroidUtils androidUtils = AndroidUtils.getAndroidUtils();11 androidUtils.swipe("text", "Views", 5000);12 }13 public void testAndroidSwipe2() {14 IAndroidUtils androidUtils = AndroidUtils.getAndroidUtils();15 androidUtils.swipe("text", "Views", 5000, "up");16 }17 public void testAndroidSwipe3() {18 IAndroidUtils androidUtils = AndroidUtils.getAndroidUtils();19 androidUtils.swipe("text", "Views", 5000, "up", 5);20 }21 public void testAndroidSwipe4() {22 IAndroidUtils androidUtils = AndroidUtils.getAndroidUtils();23 androidUtils.swipe("text", "Views", 5000, "up", 5, 1);24 }25 public void testAndroidSwipe5() {26 IAndroidUtils androidUtils = AndroidUtils.getAndroidUtils();27 androidUtils.swipe("text", "Views", 5000, "up", 5, 1, 0.5);28 }29 public void testAndroidSwipe6() {

Full Screen

Full Screen

scroll

Using AI Code Generation

copy

Full Screen

1AndroidUtils.scroll("text", "textToBeSearched", "direction");2AndroidUtils.scroll("text", "textToBeSearched", "direction", 5);3AndroidUtils.scroll("text", "textToBeSearched", "direction", 5, true);4AndroidUtils.scroll("text", "textToBeSearched", "direction", 5, true, true);5AndroidUtils.scroll("text", "textToBeSearched", "direction", 5, true, true, true);6AndroidUtils.scroll("text", "textToBeSearched", "direction", 5, true, true, true, true);7AndroidUtils.scroll("text", "textToBeSearched", "direction", 5, true, true, true, true, "textToBeSearched");8AndroidUtils.scroll("text", "textToBeSearched", "direction", 5, true, true, true, true, "textToBeSearched", 5);9AndroidUtils.scroll("text", "textToBeSearched", "direction", 5, true, true, true, true, "textToBeSearched", 5, true);10AndroidUtils.scroll("text", "textToBeSearched", "direction", 5, true, true,

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful