Application is open twice

When I’m running my test just for opening the application, it is being opened twice causing an error that follows ;

Starting Node Server
warn: Appium support for versions of node < 0.12 has been deprecated and will be removed in a future version. Please upgrade!
info: Welcome to Appium v1.4.0 (REV 8f63e2f91ef7907aed8bda763f4e5ca08e86970a)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“noReset”:true,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“16”,“automationName”:“Selendroid”,“selendroidPort”:5555}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“desiredCapabilities”:{“app”:“C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk”,“appPackage”:“com.whatsapp”,“appActivity”:“com.whatsapp.Main”,“platformVersion”:“4.1.2”,“browserName”:“”,“platformName”:“Android”,“deviceName”:“S3Mini”}}
info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_51)
info: [debug] Using local app from desired caps: C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk
info: [debug] Creating new appium session 7ae2f1e2-8dc4-4c75-8962-c440c3041457
info: [debug] Starting selendroid server
info: [debug] Getting Java version
info: Java version is: 1.8.0_51
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe
info: [debug] Checking whether selendroid is built yet
info: [debug] Selendroid server exists!
info: [debug] Using fast reset? false
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” devices
info: [debug] 1 device(s) connected
info: Found device 4790208323a9309e
info: [debug] Setting device id to 4790208323a9309e
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e wait-for-device
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\build-tools\build-tools-22.0.1\aapt.exe
info: [debug] Checking if has internet permission from manifest.
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\build-tools\build-tools-22.0.1\aapt.exe” dump badging “C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk”
info: [debug] Rebuilt selendroid server already exists, no need to rebuild it with a new manifest
info: [debug] Checking signed status of C:\Users\RAFAEL~1\AppData\Local\Temp\selendroid.com.whatsapp.apk
info: [debug] Checking app cert for C:\Users\RAFAEL~1\AppData\Local\Temp\selendroid.com.whatsapp.apk.
info: [debug] executing cmd: java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar” C:\Users\RAFAEL~1\AppData\Local\Temp\selendroid.com.whatsapp.apk
info: [debug] Checking signed status of C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk
info: [debug] Checking app cert for C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk.
info: [debug] executing cmd: java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar” “C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk”
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users\RAFAEL~1\AppData\Local\Temp\selendroid.com.whatsapp.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\build-tools\build-tools-22.0.1\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\build-tools\build-tools-22.0.1\zipalign.exe” -f 4 C:\Users\RAFAEL~1\AppData\Local\Temp\selendroid.com.whatsapp.apk C:\Users\RAFAEL~1\AppData\Local\Temp\11595-6208-6q39s4\appium.tmp
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\build-tools\build-tools-22.0.1\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\build-tools\build-tools-22.0.1\zipalign.exe” -f 4 “C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk” C:\Users\RAFAEL~1\AppData\Local\Temp\11595-6208-1huoev4\appium.tmp
info: [debug] Rebuilt selendroid apk exists, doing nothing
info: [debug] Getting install status for com.whatsapp.selendroid
info: [debug] Getting device API level
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “getprop ro.build.version.sdk”
info: [debug] MD5 for selendroid server is 4b2268efa90064976634a2af3cc0dbc6
info: [debug] Device is at API Level 16
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “pm list packages -3 com.whatsapp.selendroid”
info: [debug] App is installed
info: [debug] Rebuilt selendroid is already installed
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language: pt
info: [debug] java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk” “C:\Users\RAFAEL~1\AppData\Local\Temp\com.whatsapp” pt
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk.
info: [debug] executing cmd: java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar” “C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk”
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\build-tools\build-tools-22.0.1\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\build-tools\build-tools-22.0.1\zipalign.exe” -f 4 “C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk” C:\Users\RAFAEL~1\AppData\Local\Temp\11595-6208-v78a7\appium.tmp
info: [debug] MD5 for app is 40d5a4f52dff7c4d3d480840bac051b6
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “ls /data/local/tmp/40d5a4f52dff7c4d3d480840bac051b6.apk”
info: [debug] Getting install status for com.whatsapp
info: [debug] Getting device API level
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 16
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “pm list packages -3 com.whatsapp”
info: [debug] App is installed
info: [debug] Forwarding system:5555 to device:8080
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e forward tcp:5555 tcp:8080
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e install “C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “dumpsys window”
info: [debug] Screen already unlocked, continuing.
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “am instrument -e main_activity ‘com.whatsapp.Main’ com.whatsapp.selendroid/io.selendroid.server.ServerInstrumentation”
info: [debug] Making http request with opts: {“url”:“http://localhost:5555/wd/hub/status",“method”:"GET”}
info: [debug] Making http request with opts: {“url”:“http://localhost:5555/wd/hub/status",“method”:"GET”}
info: [debug] Making http request with opts: {“url”:“http://localhost:5555/wd/hub/status",“method”:"GET”}
info: [debug] Making http request with opts: {“url”:“http://localhost:5555/wd/hub/status",“method”:"GET”}
info: [debug] Selendroid server is alive!
info: [debug] Listening for Selendroid logs
info: [debug] Creating Selendroid session
info: [debug] Making http request with opts: {“url”:“http://localhost:5555/wd/hub/session",“method”:“POST”,“json”:{“desiredCapabilities”:{“warnings”:{},“desired”:{“app”:"C:\\Users\\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk”,“appPackage”:“com.whatsapp”,“appActivity”:“com.whatsapp.Main”,“platformVersion”:“4.1.2”,“browserName”:“”,“platformName”:“Android”,“deviceName”:“S3Mini”},“app”:“C:\Users\Rafael Waterkemper\workspace\AutomationMobile\Apps\Amazon\com.whatsapp-2.12.250-450663-minAPI7.apk”,“appPackage”:“com.whatsapp”,“appActivity”:“com.whatsapp.Main”,“platformVersion”:“4.1.2”,“browserName”:“”,“platformName”:“Android”,“deviceName”:“S3Mini”}}}
info: [debug] Successfully started selendroid session
info: [debug] Waiting for pkg “com.whatsapp” and activity “com.whatsapp.Main” to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “dumpsys window windows”
error: com.whatsapp/.Main never started. Current: com.whatsapp/.EULA
info: [debug] Selendroid hasn’t started app yet, let’s do it manually with adb.startApp
info: [debug] Getting device API level
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 16
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.whatsapp/com.whatsapp.Main”
info: [debug] [SELENDROID] (SystemEventReceiver, 46) android.intent.action.PACKAGE_RESTARTED
info: [debug] [SELENDROID] android.intent.action.PACKAGE_RESTARTED
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
info: [debug] Waiting for pkg “com.whatsapp” and activity “com.whatsapp.Main” to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: “C:\Users\Rafael Waterkemper\Documents\FACULDADE E MAIS\Desenvolvimento\SDK Android\SDK\platform-tools\adb.exe” -s 4790208323a9309e shell “dumpsys window windows”
info: [debug] Overriding session id with “f427a0ed-6f28-9b96-9e6c-3a876816b900”
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId f427a0ed-6f28-9b96-9e6c-3a876816b900
info: ← POST /wd/hub/session 303 33207.877 ms - 74
info: → GET /wd/hub/session/f427a0ed-6f28-9b96-9e6c-3a876816b900 {}
info: [debug] Proxying command to localhost:5555
info: [debug] Making http request with opts: {“url”:“http://localhost:5555/wd/hub/session/f427a0ed-6f28-9b96-9e6c-3a876816b900",“method”:"GET”}
info: [debug] Responding to client with error: {“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command.”,“origValue”:“Did not successfully proxy server command”},“sessionId”:“f427a0ed-6f28-9b96-9e6c-3a876816b900”}
info: ← GET /wd/hub/session/f427a0ed-6f28-9b96-9e6c-3a876816b900 500 8.744 ms - 210
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
Killed Node Server.
Node Server Process Ended

Aqui está meu código:

import io.appium.java_client.AppiumDriver;

import java.io.File;
import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

public class StartApplication {

private static AppiumDriver<WebElement> driver;
public static void main(String[] args) throws MalformedURLException, InterruptedException {

	File classpathRoot = new File(System.getProperty("user.dir"));
	File appDir = new File(classpathRoot, "/Apps/Amazon/");
	File app = new File(appDir, "com.whatsapp-2.12.250-450663-minAPI7.apk");

	DesiredCapabilities capabilities = new DesiredCapabilities();
	capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
	capabilities.setCapability("deviceName", "S3Mini");
	capabilities.setCapability("platformVersion", "4.1.2");
	capabilities.setCapability("platformName", "Android");
	capabilities.setCapability("app", app.getAbsolutePath());
	capabilities.setCapability("appPackage", "com.whatsapp");
	capabilities.setCapability("appActivity", "com.whatsapp.Main");
	
	driver = new AppiumDriver<WebElement>(new java.net.URL("http://127.0.0.1:4723/wd/hub"), capabilities) {
		
		@Override
		public WebElement scrollTo(String arg0) {
			return null;
		}

		@Override
		public WebElement scrollToExact(String arg0) {
			return null;
		}
	};
	
}

}

1 Like