Is it possible for test an existing app in the Android phone. Training videos used the sample android app when creating test case in katalon studio. If i need to test an thirdparty app is it possible to do as I dont have the apk file?
can anyone help me regarding this query
Yes you can do this.
Requirement–>To test native application already installed without the APK path
Start application keyword has mandatory parameter which is the path of the apk file .
User can create Mobile/Android session using the below code
AppiumDriverManager.createMobileDriver(MobileDriverType.ANDROID_DRIVER, capabilities, new URL(AppiumUrl ))
How to execute
User need to manually start the Appium Server with the port mentioned in
String AppiumUrl = ‘http://0.0.0.0:5500/wd/hub’
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.remote.DesiredCapabilities as DesiredCapabilities
import com.kms.katalon.core.appium.driver.AppiumDriverManager as AppiumDriverManager
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
import com.kms.katalon.core.mobile.driver.MobileDriverType as 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 as AndroidDriver
import io.appium.java_client.AppiumDriver as AppiumDriver
String AppiumUrl = ‘http://0.0.0.0:5500/wd/hub’
//DesiredCapabilities capabilities = new DesiredCapabilities();
DesiredCapabilities capabilities = new DesiredCapabilities()
capabilities.setCapability(‘sessionName’, ‘Automation test session’)
capabilities.setCapability(‘deviceName’, ‘ce0117110d1f643104’)
capabilities.setCapability(‘platformVersion’, ‘7.0’)
capabilities.setCapability(‘platformName’, ‘Android’)
capabilities.setCapability(‘appActivity’, ‘com.sec.android.app.popupcalculator.Calculator’)
capabilities.setCapability(‘appPackage’, ‘com.sec.android.app.popupcalculator’)
AppiumDriverManager.createMobileDriver(MobileDriverType.ANDROID_DRIVER, capabilities, new URL(AppiumUrl ))
Mobile.tap(findTestObject(‘Calci/android.widget.Button10 - 5’), 0)
Mobile.tap(findTestObject(‘Calci/android.widget.Button10 - 5’), 0)
Mobile.tap(findTestObject('Calci/android.widget.Button16 - '), 0)
Mobile.tap(findTestObject(‘Calci/android.widget.Button15 - 3’), 0)
Mobile.tap(findTestObject('Calci/android.widget.Button20 - '), 0)
Mobile.tap(findTestObject(‘Calci/android.widget.EditText0 - 58’), 0)
Mobile.closeApplication()
hi i followed the following code however i am always having the error on this one “String AppiumUrl = ‘http://0.0.0.0:5500/wd/hub’”
The error displays :
Test Cases/3412 Sign in/3542 Account Login Form Validation FAILED because (of) (Stack trace: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find adb Please set the ANDROID_HOME environment variable with the Android SDK root directory path. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 177 milliseconds
Do you have any idea on how to fix this? Thanks!
The error message is obvious here: Please set the ANDROID_HOME environment variable with the Android SDK root directory path
-> you need to set ANDROID_HOME
environment variable to your system, and you can refer to this guide.
By default, Android SDK will be installed to: C:\Users\<your username>\.katalon\tools\android_sdk
in case you follow installation dialog. Otherwise just use your custom Android SDK folder correctly.
Hi,
I followed the following code however i am always having the error:
Test Cases/Check_Open app FAILED.
Reason:
org.openqa.selenium.WebDriverException: Connection refused: connect
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
Do you have any idea on how to fix this? Thanks!
Can you show the full logs?
Hi @Zarashima, i have same problem here. Here it is the log:
org.openqa.selenium.WebDriverException: Connection refused: connect
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘BAUDSKFS011746’, ip: ‘169.254.119.118’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: driver.version: AppiumDriverManager$createMobileDriver
at io.appium.java_client.remote.AppiumCommandExecutor.lambda$5(AppiumCommandExecutor.java:251)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.execute(SwipeableAndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:94)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:95)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.(SwipeableAndroidDriver.java:19)
at com.kms.katalon.core.appium.driver.AppiumDriverManager.createMobileDriver(AppiumDriverManager.java:463)
at com.kms.katalon.core.appium.driver.AppiumDriverManager$createMobileDriver.call(Unknown Source)
at com.mobile.keywords.ApplicationBehavior.startInstalledApplication(ApplicationBehavior.groovy:25)
at com.mobile.keywords.ApplicationBehavior.invokeMethod(ApplicationBehavior.groovy)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
at 01.2.01.FoodMOB-6_Realizar o login.run(01.2.01.FoodMOB-6_Realizar o login:7)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1565899182690.run(TempTestCase1565899182690.groovy:21)
Caused by: java.net.ConnectException: Connection refused: connect
at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:245)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:165)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:103)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
… 29 more