Run Appium Test with TestObject platform [SOLVED]

Appium v1.6.3 Xcode Version 8.0

I want to run appium automation in ios app. It works fine when I run it in my devices and simulator. TestObject is a platform where it offers to run my test cases in their offering devices. But the problem is I cannot run my test case there. I tried with different sample apps, and they worked fine.

The app I’m trying to run is a drawing app. I tried a simple scenario, to tap on a button, enter a saved drawing set and exit.

When I check appium log offered by TestObject platform it says unable to find element. I have used accessibility id in ios app.

button.accessibilityIdentifier = @"home_myartworks_button";
button.accessibilityLabel = @"My Artworks";

This is the basic setup they offered. https://help.testobject.com/docs/tools/appium/setups/junit/basic/

And I have added the watcher setup they have offered.

This is the test script I’m trying to run. package appium;

package appium;

import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.junit.Test;
import org.testobject.appium.junit.TestObjectTestResultWatcher;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.ios.IOSDriver;

public class watcher {
private AppiumDriver driver;
 /* This is the key piece of our test, since it allows us to
 * connect to the device we will be running the app onto.*/
 /* Sets the test name to the name of the test method. */
 @Rule
public TestName testName = new TestName();

/* Takes care of sending the result of the tests over to TestObject. */
@Rule
public TestObjectTestResultWatcher resultWatcher = new TestObjectTestResultWatcher();

/* This is the setup that will be run before the test. */
@Before
public void setUp() throws Exception {

	DesiredCapabilities capabilities = new DesiredCapabilities();
    
  	capabilities.setCapability("testobject_appium_version", "1.6.0-updated-chromedriver");
	capabilities.setCapability("testobject_api_key", "5943EFA752334F28B12D55FDE458648D");
	capabilities.setCapability("testobject_device", "iPhone_7_32GB_10_real");
	capabilities.setCapability("testobject_cache_device", "false");
	capabilities.setCapability("testobject_suite_name", "KIDMainView");
	capabilities.setCapability("testobject_test_name", "DDbutton");
	capabilities.setCapability("orientation", "LANDSCAPE");
	capabilities.setCapability("autoAcceptAlerts", true); 
             driver = new IOSDriver (new URL("http://appium.testobject.com/wd/hub"), capabilities);
            /* IMPORTANT! We need to provide the Watcher with our initialized AppiumDriver */
           resultWatcher.setRemoteWebDriver(driver);
       /* IMPORTANT! driver.quit() is not called anymore, as the Watcher is now
       taking care of this. You can get rid of the tearDown method. *
     @Test
     public void testMethod() {
    /* Your test. */
	
	driver.getPageSource();
	driver.findElement(By.name("home_myartworks_button")).click();
	driver.findElement(By.name("Close")).click() }}

My issues are,

  1. Why appium log says it cannot find element? I have run it successfully in my device and simulator. This is the TestObject appium log.

04:16:07 VERBOSE: [debug] [35m[JSONWP Proxy][39m Proxying [POST /element] to [POST http: //aaaa/session/B558AFFF-74D94229-9F8D-7E72C6F0D707/element] with body:“using”:“name”,“value”:“home_myartworks_button”} 04:16:07 VERBOSE: [debug] [35m[JSONWP Proxy][39m Got response withstatus200{“value”:“using”:“name”,“value”:“home_myartworks_button”,“description”:“unable to find an element”},“sessionId”:“B558AFFF-74D9-4229-9F8D-7E72C6F0D707”,“status”:7}

Solved using

//Launch app
	driver.launchApp();

The issue was app did not launch, it was only installed.
I had to launch it with script.