0

I'm constructing an mobile automation frame using appium with webdriverIO. My employer is in the early stages of constructing their app so I'm using a boilplate WDIO app as it's a hybrid app.

I'm using the desired capabilities in appium inspector which have worked perfectly in the past. However, I can't get Appium inspector to load the app on its screen (However, it's loading perfectly on the iOS simulator).

did I miss something?

What I'm seeing on my screen

enter image description here

WDIO file Desired Capabilities:

capabilities: [{
        // capabilities for local Appium web tests on iOS
        platformName: 'iOS',
        "appium:platformVersion":"18.1",
        "appium:DeviceName":"iphone 16",
        "appium:automationName":"XCUITest",
        'appium:app': path.join(process.cwd(), 'App', 'iOS','wdiodemoapp.app'),
        'appium:noReset': true,
        'appium:autoAcceptAlerts': true,
        'appium:newCommandTimeout': 300
    }],

Appium Inspector Desired Capabilities

{
  "platformName": "iOS",
  "appium:deviceName": "iPhone 16",
  "appium:platformVersion": "18.1",
  "appium:automationName": "XCUITest"
}

Appium inspector session information

ession URL  http://127.0.0.1:4724/wd/hub/session/d4d63b31-a737-4b90-b51b-708244dba43b
Session Length  00:52:01
Server Details  
version 3.0.2
git-sha 93990ab7da37007c8d9db16415cfb939aa5dd201
built   2018-04-25 13:25:35 -0700
Session Details 
platformName    iOS
deviceName  iPhone 16
platformVersion 18.1
automationName  XCUITest
includeSafariInWebviews true
newCommandTimeout   3600
connectHardwareKeyboard true
Currently Active App ID com.apple.springboard
 Start this Kind of Session with Code
// This sample code supports Appium Java client >=9
// https://github.com/appium/java-client
import io.appium.java_client.remote.options.BaseOptions;
import io.appium.java_client.AppiumBy;
import io.appium.java_client.ios.IOSDriver;
import java.net.URL;
import java.net.MalformedURLException;
import java.time.Duration;
import java.util.Arrays;
import java.util.Base64;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.*;

public class SampleTest {

  private IOSDriver driver;

  @Before
  public void setUp() {
    Capabilities options = new BaseOptions()
      .amend("platformName", "iOS")
      .amend("appium:deviceName", "iPhone 16")
      .amend("appium:platformVersion", "18.1")
      .amend("appium:automationName", "XCUITest")
      .amend("appium:includeSafariInWebviews", true)
      .amend("appium:newCommandTimeout", 3600)
      .amend("appium:connectHardwareKeyboard", true);    

    driver = new IOSDriver(this.getUrl(), options);
  }

  @Test
  public void sampleTest() {

  }

  @After
  public void tearDown() {
    driver.quit();
  }

  private URL getUrl() {
      try {
        return new URL("http://127.0.0.1:4724/wd/hub");
      } catch (MalformedURLException e) {
        e.printStackTrace();
      }
    }
}

1 Answer 1

0

The desired capabilities in the question were showing the session starts without an app explicitly selected, which makes the springboard being selected by default. So the above json capabilities normally work just fine - just not in this instance.

I wanted to check everything was working fine, I did some initial checks to ensure everything was running ok with the simulators using commands xcrun simctl list devices and xcrun simctl list devices | grep iPhone and I was able to locate phone simulator and that it was booted.

I then used an absolute path in the examples below.

  • Also, don't forget to save the json capabilities before firing up the inspector (appium: app - used an absolute path from VSC). Finally, make sure ALL ports in running appium and used in inspector have the same number. Either json will work and meet the requirements for appium 3
{
  "platformName": "iOS",
  "appium:deviceName": "iPhone 16",
  "appium:platformVersion": "18.1",
  "appium:automationName": "XCUITest",
  "appium:app": "/Users/<my_directory_here>/<my_project_here>/App/iOS/wdiodemoapp.app",
  "appium:noReset": true,
  "appium:newCommandTimeout": 300
}

or

{
  "alwaysMatch": {
    "platformName": "iOS",
    "appium:deviceName": "iPhone 16",
    "appium:platformVersion": "18.1",
    "appium:automationName": "XCUITest",
    "appium:app": "/Users/<my_directory_here>/<my_project_here>/App/iOS/wdiodemoapp.app",
    "appium:noReset": true,
    "appium:newCommandTimeout": 300
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.