I am not able to connect to my app. Not getting what to enter in appPack and appActivity.
Steps :
Started Appium Server and connected node appium
Executed the below script
My device is connected and showing online too. When I executed this code it is not showing any error.
Please let me know where my script is incorrect.
public class testApp {
/**
@param args
*/
public class movein {
// TODO Auto-generated method stub
WebDriver dr; @Test
public void testApp() throws MalformedURLException, InterruptedException{
File app = new File("F:\\Mobile-testing\\apps\abc.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName","Nexus 5");
capabilities.setCapability("platformVersion", "4.4.4");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.abc");
capabilities.setCapability("appActivity", "com.abc");
dr = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
dr.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
// clicking
} }}
My Appium settings :
Server : 127.0.0.1 Port :4723
Appium Info :
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“18”,“automationName”:“Appium”}
what kind of running container you are using ? Junit or TestNG ?
If you are using TestNG, have you assigned the testing.xml in the project’s properties ?
If you are testing .apk, no need to specify the CapabilityType.BROWSER_NAME. This is just a suggestion, if you do this, it will not cause any error as well.
The appActivity property, i don’t know if yours is correct. In general, the activity should start with “.”
For example, “.com.abc.XXXX”
The code looks like no problem, please try again and post the error log please.
I am using TestNG and I got appPackage and appActivity from adb logs.
Commented for Browser_Name and runned the script.
Showing error :
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Thanks, it works.
But I am getting now this error :
error: Failed to start an Appium session, err was: Error: ‘java -version’ failed. Error: spawn ENOENT
info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.7.0_79)
info: [debug] Didn’t get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session 008a6e68-5c85-48dd-bc8b-378ed29a73e5
info: Starting android appium
info: [debug] Getting Java version
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: ‘java -version’ failed. Error: spawn ENOENT
at [object Object]. (D:\Appium\node_modules\appium\lib\devices\android\android-common.js:1057:17)
at exithandler (child_process.js:633:7)
at ChildProcess.errorhandler (child_process.js:649:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:795:12)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: ‘java -version’ failed. Error: spawn ENOENT)”,“origValue”:“‘java -version’ failed. Error: spawn ENOENT”},“sessionId”:null}
info: ← POST /wd/hub/session 500 12.433 ms - 208
I have removed JRE from the path. Script is running but it is showing me error.
error: Failed to start an Appium session, err was: Error: Permission to start activity denied.
.
.
.
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Permission to start activity denied.)”,“origValue”:“Permission to start activity denied.”},“sessionId”:null}