Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Android Mobile app automation sample for Katalon + BrowserStack
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.remote.DesiredCapabilities
import com.kms.katalon.core.appium.driver.AppiumDriverManager
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
import com.kms.katalon.core.mobile.driver.MobileDriverType
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.util.internal.PathUtil as PathUtil
import internal.GlobalVariable as GlobalVariable
import io.appium.java_client.android.AndroidDriver
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import internal.GlobalVariable as GlobalVariable
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.util.internal.PathUtil as PathUtil
String browserStackServerURL = "https://USERNAME:ACCESS_KEY@hub-cloud.browserstack.com/wd/hub";
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device", "Samsung Galaxy S8");
capabilities.setCapability('app', 'bs://hashed_ID')
AppiumDriverManager.createMobileDriver(MobileDriverType.ANDROID_DRIVER, capabilities, new URL(browserStackServerURL))
Mobile.comment('Story: Verify correct alarm message')
Mobile.comment('He navigates the application to Graphics form')
Mobile.tap(findTestObject('Application/android.widget.TextView - Graphics'), GlobalVariable.G_Timeout)
Mobile.comment('When he scroll to Xfermodes text')
Mobile.scrollToText('Xfermodes')
Mobile.comment('Then the current screen should show Xfermodes text after scrolling')
'Get item\'s label'
def itemText = Mobile.getText(findTestObject('Application/Graphics/android.widget.TextView - Xfermodes'), GlobalVariable.G_Timeout)
Mobile.verifyEqual(itemText, 'Xfermodes')
Mobile.closeApplication()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment