Manju
Manju

Reputation: 728

Appium switch application is not working

Here is the log

Test Andriod Demo :: App for appium library

OpenApplication1
| PASS | OpenApplication2
| FAIL | URLError: SwitchApplication1
| FAIL | Variable '${browser}' not found.

Here is the Test case

OpenApplication1
    ${browser}  Open Application  http://localhost:4723/wd/hub  platformName=Android  platformVersion=4.2.2  deviceName=192.168.56.101:5555  app=${CURDIR}/demoapp/Browser.apk  automationName=appium  appPackage=com.app.robot  appActivity=MainActivity
OpenApplication2    
    ${app}  Open Application  http://localhost:4725/wd/hub  platformName=Android  platformVersion=4.2.2  deviceName=192.168.56.101:5555  app=${CURDIR}/demoapp/QA.apk  automationName=appium  appPackage=com.app.test  appActivity=LoginActivity
SwitchApplication1
    Switch Application   ${browser}

Sincerely looking for an answer

Upvotes: 2

Views: 1792

Answers (4)

Durai Amuthan.H
Durai Amuthan.H

Reputation: 32280

While the first application is running you can launch second application but you have to kill the second application to come back where you left off in the first application

OpenApplication2 

./adb shell monkey -p com.test.t1 -c android.intent.category.LAUNCHER 1

CloseApplication2

./adb shell am force-stop com.test.t1

FYI:

  • adb -> To connect with the device
  • shell -> To make use of terminal or command prompt
  • am -> Activity Manager
  • monkey -> The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.

use the keyword execute to run adb

Upvotes: 1

Toral
Toral

Reputation: 305

A workaround worked for me. Try this.

 OpenApplication1
 OpenApplication2
 Switch Application ${browser}
 Background App 5

After last keyword, it will switch to Application1

Upvotes: 0

Rakesh patanga
Rakesh patanga

Reputation: 822

I also have tried like you But Switch application is not implemented as of now in Appium for Robot Framework

Upvotes: 0

King
King

Reputation: 3095

I solved the problem by closing the first application and opening the second application.

use this below command

   OpenApplication1

do some activities with that then close the application

   Close Application
   OpenApplication2

Upvotes: 2

Related Questions