Date post: | 08-Feb-2017 |
Category: |
Technology |
Upload: | vodqa |
View: | 42 times |
Download: | 2 times |
Advance Appium Workshop
Mobile automation using Appium : An open source, cross platform tool for automating native, mobile web and hybrid
applications
Instruments Controller
(iOS)
Instruments Command Server
Unix Socket Server
Instruments Command Client
Unix Socket Client
Instruments
bootstrap.js
WebDriver Controller
iOS - UI Automation
WebDriver Script
UiAutomator Controller (Android)
UiAutomator Command
Client
TCP Client
WebDriver Controller
Android - UI Automator (4.2+), Selendroid (2.3+)
WebDriver Script
TCP Server
UiAutomator Command
Server
bootstrap.jar
Appium Dependency Graph
Appium Dependency Graph
Horizontal Swiping
X Axis
Y Axis
(0,H/2)
(0,0)
(W/2,H/2)
Slider Element
Vertical Swiping
X Axis
Y Axis
(0,0)H
EIG
HT
Width
(W/2, H-20)
(W/2, H/2 + 50)
Deprecated Method in 5.0.0
★ AppiumDriver#swipe(int, int, int, int, int)★ AppiumDriver#pinch(WebElement)★ AppiumDriver#pinch(int, int)★ AppiumDriver#zoom(WebElement)★ AppiumDriver#zoom(int, int)★ AppiumDriver#tap(int, WebElement, int)★ AppiumDriver#tap(int, int, int, int)★ AppiumDriver#swipe(int, int, int, int, int)★ MobileElement#swipe(SwipeElementDirection, int)★ MobileElement#swipe(SwipeElementDirection, int, int, int)★ MobileElement#zoom()★ MobileElement#pinch()★ MobileElement#tap(int, int)★ io.appium.java_client.SwipeElementDirection★ io.appium.java_client.TouchebleElement
PageObjects Via AppiumFieldDecorator
@FindBy(someStrategy) //for browser or web view html UI@AndroidFindBy(someStrategy) //for Android native UI @iOSFindBy(someStrategy) //for iOS native UI MobileElement someElement;
//the fully cross platform examle@FindBy(someStrategy)@AndroidFindBy(someStrategy) //for Android native UI @iOSFindBy(someStrategy) //for iOS native UI List<MobileElement> someElements;
PageObjects Locators
UIAutomator
iOSNsPredicates
IdclassNameaccessibilityIDtagNameXPath
iOS9
iOS10
iOSFindBy
iOSXCUITFindBy
Chained Locators
@FindBys({@FindBy(someStrategy1), @FindBy(someStrategy2)}) @AndroidFindBy(parent) @AndroidFindBy(child)@iOSFindBy(parent) @iOSFindBy(child) MobileElement someElement;
@FindBys({@FindBy(someStrategy1), @FindBy(someStrategy2)}) @AndroidFindBy(parent) @AndroidFindBy(child)@iOSFindBy(parent) @iOSFindBy(child)List<MobileElement> someElements;
Any Possible
@HowToUseLocators(androidAutomation = ALL_POSSIBLE, iOSAutomation = ALL_POSSIBLE)@FindAll{@FindBy(someStrategy1), @FindBy(someStrategy2)}) @AndroidFindBy(fakeID1) @AndroidFindBy(someStrategy2) @iOSFindBy(fakeID1) @iOSFindBy(someStrategy2) MobileElement someElement;
@HowToUseLocators(androidAutomation = ALL_POSSIBLE, iOSAutomation = ALL_POSSIBLE)@FindAll({@FindBy(someStrategy1), @FindBy(someStrategy2)}) @AndroidFindBy(fakeID1) @AndroidFindBy(someStrategy2)@iOSFindBy(fakeID1) @iOSFindBy(someStrategy2)List<MobileElement> someElements;
Any Possible
@HowToUseLocators(androidAutomation = ALL_POSSIBLE, iOSAutomation = ALL_POSSIBLE, iOSXCUITAutomation = ALL_POSSIBLE)@FindAll({@FindBy(someStrategy1), @FindBy(someStrategy2)}) @AndroidFindBy(fakeID1) @AndroidFindBy(someStrategy2)@iOSFindBy(fakeID1) @iOSFindBy(someStrategy2)@iOSFindBy(uiAutomator = "scrollViews().firstWithPredicate(\"value CONTAINS 'View one' \")")@iOSXCUITFindBy(iOSNsPredicate = "label contains 'View one'")@iOSXCUITFindBy(className = "fakeID1")@iOSXCUITFindBy(accessibility = "fakeID2")List<MobileElement> someElements;
WaitTimeOut
PageFactory.initElements(new AppiumFieldDecorator(searchContext, /*searchContext is a WebDriver or WebElement instance */ new TimeOutDuration(15, //default implicit waiting timeout for all strategies TimeUnit.SECONDS)), pageObject //an instance of PageObject.class);If time of the waiting for elements differs from usual (longer, or shorter when element is needed only for quick checkings/assertions)@WithTimeout(timeOut = yourTime, timeUnit = yourTimeUnit)MobileElement someElement;
@WithTimeout(timeOut = yourTime, timeUnit = yourTimeUnit)List<MobileElement> someElements;
References
• vodQA Github - https://github.com/saikrishna321/VodQa_MobileAutomationWorkShop
• Appium Architecture - http://appium.io/slate/en/master/?java#introduction-to-appium
• Appium [Sauce Labs] - https://saucelabs.com/appium• https://github.com/SrinivasanTarget/awesome-appium• https://github.com/hariharanwebmail/VodQAReactNative• https://github.com/saikrishna321/VodQaAdvancedAppium• https://github.com/saikrishna321/AppiumTestDistribution• https://github.com/saikrishna321/PageObjectPatternAppium• https://github.com/appium/java-client