After running my script, I am getting the screen shown here:
When i am trying to actually launch the selenroid app, can anyone please let me know why the app that i have called from the following script is not launching?
testthis.java code(under second package name):
package demolaunchtest;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class testthis {
public static AndroidDriver driver;
@BeforeClass
public void setUP() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device", "Android");
capabilities.setCapability("deviceName", "Lokesh Gangaiah");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "5.0");
capabilities.setCapability("appPackage", "io.selendroid.testapp");
capabilities.setCapability("appActivity", "io.selendroid.testapp.HomeScreenActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void Sel_Button_Test() throws InterruptedException {
System.out.println("Test Started");
WebElement ButtonElement = driver.findElementById("io.selendroid.testapp:id/buttonStartWebview");
ButtonElement.click();
Thread.sleep(3000L);
System.out.println("Test has been completed");
}
@AfterClass
public void tearDown()
{
driver.quit();
}
}
MainActivity.java - under first package :
package com.example.demo;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
AndroidMainfest.xml code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.demo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Appiumg logs: it does not have any error reported:
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d) info: Appium REST http interface listener started on 127.0.0.1:4723 info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"deviceName":"Lokesh Gangaiah","platformName":"Android","platformVersion":"21","automationName":"Appium","language":"en","locale":"AU"} info: Console LogLevel: debug
The logs in the eclipse console:
Android Launch! adb is running normally. Performing com.example.myapp1.MainActivity activity launch Uploading myapp1.apk onto device '00bd9781' Installing myapp1.apk... Success! Starting activity com.example.myapp1.MainActivity on device 00bd9781 ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.myapp1/.MainActivity }