Last Updated
Viewed 579 Times
           

I have trying following code but it displays error message:

driver.rotate(org.openqa.selenium.ScreenOrientation.LANDSCAPE); 
Thread.sleep(5000); driver.rotate(org.openqa.selenium.ScreenOrientation.PORTRAIT); 
Thread.sleep(5000);

Error message:-

An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)

The problem: My app opens up and shuts off before ScrollTo() command execution.

I got this error on Appium:

'Encountered internal error running command: Error: Error occured while starting App. Original error: com.disney.wdpro.android.mdx.activities.LoaderActivity or com.disney.mdx.wdw.google.com.disney.wdpro.android.mdx.activities.LoaderActivity never started'

Appium logs:

[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vovan\AppData\Local\Android\sdk\platform-
tools\adb.exe' with args: ["-P",5037,"-
s","IRN7HITKLFOFVKK7","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` 
capability if wanted.
[MJSONWP] Encountered internal error running command: Error: Error occured 
while starting App. Original error: 
com.disney.wdpro.android.mdx.activities.LoaderActivity 

orcom.disney.mdx.wdw.google.com.android.mdx.activities.LoaderActiv
ity never started
at Object.wrappedLogger.errorAndThrow 
(C:\Users\vovan\AppData\Local\Programs\appium- 
desktop\resources\app\node_modules\appium\node_modules\appium-
support\lib\logging.js:63:13)
at ADB.callee$0$0$ (C:\Users\vovan\AppData\Local\Programs\appium-
desktop\resources\app\node_modules\appium\node_modules\appium-
adb\lib\tools\apk-utils.js:79:9)

Selenium Code Eclipse:

    public void test() throws MalformedURLException, InterruptedException {
    File appDir = new File("src");
    File app = new File(appDir, "com.disney.mdx.wdw.google.apk");

    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability(MobileCapabilityType.PLATFORM_NAME, 
    MobilePlatform.ANDROID);
    cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Device");
    cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "50");
    cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());

    AndroidDriver driver = new AndroidDriver(new 
    URL("http://169.254.159.242:4723/wd/hub"), cap);
    driver.scrollTo("Get Started");
    TouchActions t = new TouchActions(driver);
    WebElement abc = 
    driver.findElementById("com.disney.mdx.wdw.google:id/tutorial_button");
    t.singleTap(abc).perform();

I have written a simple code to just open google chrome browser on Android launch a web url and to close the browser, below is my code:

package com.roofandfloor.initial;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;

public class SampleCode {

    public static void main(String[] args) throws MalformedURLException {
        DesiredCapabilities capabilities = DesiredCapabilities.android();
        capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
        capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Micromax");
        capabilities.setCapability(MobileCapabilityType.VERSION, "5.0");
        URL url = new URL("http://127.0.0.1:4723/wd/hub");
        WebDriver driver = new AndroidDriver<>(url,capabilities);
        driver.get("https://www.facebook.com");
        driver.quit();

    }

}

I am getting an error at the line "WebDriver driver = new AndroidDriver<>(url,capabilities);"

below is the logs from APPIUM:

> info: --> POST /wd/hub/session {"desiredCapabilities":{"browserName":"chrome","platformName":"Android","version":"5.0","deviceName":"Micromax","platform":"ANDROID"}}
> info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_131)
> info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version, platform
> info: Set mode: Proxying straight through to Chromedriver
> info: [debug] Looks like we want chrome on android
> info: [debug] Creating new appium session 4af282c8-e0e4-45c3-873c-3d10ccfc5229
> info: [debug] Checking whether adb is present
> warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
> info: [debug] executing cmd: where adb
> info: [debug] Using adb from C:\Users\admin\AppData\Local\Android\android-sdk\platform-tools\adb.exe
> 
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Not checking whether app is present since we are assuming it's already on the device
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: "C:\Users\admin\AppData\Local\Android\android-sdk\platform-tools\adb.exe" devices
> info: [debug] 1 device(s) connected
> info: Found device 0123456789ABCDEF
> info: [debug] Setting device id to 0123456789ABCDEF
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: "C:\Users\admin\AppData\Local\Android\android-sdk\platform-tools\adb.exe" -s 0123456789ABCDEF wait-for-device
> info: [debug] executing cmd: "C:\Users\admin\AppData\Local\Android\android-sdk\platform-tools\adb.exe" -s 0123456789ABCDEF shell "echo 'ready'"
> info: [debug] Starting logcat capture
> error: Logcat capture failed: spawn ENOENT
> info: [debug] Cleaning up appium session
> error: Failed to start an Appium session, err was: Error: spawn ENOENT
> info: [debug] Error: spawn ENOENT
>     at errnoException (child_process.js:988:11)
>     at Process.ChildProcess._handle.onexit (child_process.js:779:34)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: spawn ENOENT)","code":"ENOENT","errno":"ENOENT","syscall":"spawn","origValue":"spawn ENOENT"},"sessionId":null}
> info: <-- POST /wd/hub/session 500 6536.205 ms - 197 

On Eclipse I am getting the following error:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: spawn ENOENT)

I am not able to understand why the above error message is coming.

Below are the versions software tat I am using

Selenium Server Sstandalone: 2.53.1
Java Client for Appium 4.1.2
Appium Version: 1.4.13.1

please help in resolving the issue, I am very new to APPIUM.

I launch Appium with administrator rights I use Allow session override from Advanced settings of appium

All i want is to launch an app from my device, which is already installed but i get this error: An unknown server-side error occurred while processing the command. Original error: 'app' option is required for reinstall

And this is the code i try to run

package appiumtests;

import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;

public class Appiumtest {



    static AppiumDriver<MobileElement> driver;


    public static void main(String[] args) {

        try {
             openCasino();
        }catch(Exception exp) {
            System.out.println(exp.getCause());
            System.out.println(exp.getMessage());
            exp.printStackTrace();
        }       

    }

    public static void openCasino() throws Exception  {

        DesiredCapabilities cap = new DesiredCapabilities();


        cap.setCapability("deviceName","Mi A1");        
        cap.setCapability("udid","1d36c8469805");
        cap.setCapability("platformName", "Android");
        cap.setCapability("platformVersion", "9");
        cap.setCapability("appPackage", "eu.fortunagroup.casino.efortuna.ro.splashscreen.SplashScreenActivity");
        cap.setCapability("appActivity", "splashscreen.SplashScreenActivity.Casino");
        cap.setCapability("appWaitDuration,30000",true);
        cap.setCapability("", "");
        cap.setCapability("launchActivity ", "old.SplashActivity");
        cap.setCapability("newCommandTimeout", "3000");


        URL url = new URL("http://0.0.0.0:4723/wd/hub");    

        driver = new AppiumDriver<MobileElement>(url, cap);     

        System.out.println("Application Started");



    }   

}

Similar Question 5 (2 solutions) : Getting Exception NoClassDefFoundError in Appium

Similar Question 6 (1 solutions) : Appium - Android Hybrid app

Similar Question 7 (1 solutions) : Appium - Popup Alert message is not getting dismiss

Similar Question 9 (2 solutions) : Appium: custom android app keeps crashing on launch

cc