Appium 1.4.13 both the Android and iOs tests are failing

Hi,

Any help on these will be greatly appreciated. I have given all the details on what i have tried including checking appium forums in discuss and git hub

I used Appium 1.3.7 where i used to run tests on Android devices and it worked for Mobile, Native and Hybrid apps.
I have switched to Appium 1.4.13 to run the tests as it supports latest iOs 9.0 (Iphone Simulator). Here are the details :

a. Could not find a device to launch. Cannot Launch iPhone 5 9.0 Simulator (Followed all the steps here, git clone, developer settings, reset.sh etc)
b. Started appium in the terminal (sudo su) and launched in the Appium UI. Strange thing is in GUI nothing gets logged which was unlike previous version i used to have 1.3.7
Snapshot below for GUI :


c. I have also installed xcode and xcode command line tools. Also followed all the steps to troubleshoot the issue as mentioned in


d. Code i have written in Eclipse to run the test to launch safari on iphone simulator

package appiumpackage;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;

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

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;

public class iphone {

public static IOSDriver driver;

@Test
public void iphoneApp() throws MalformedURLException, InterruptedException {

  DesiredCapabilities capabilities = new DesiredCapabilities();
  capabilities.setCapability("deviceName", "iPhone 6");
  capabilities.setCapability("platformName", "iOS");
  capabilities.setCapability("platformVersion", "9.0");
  capabilities.setCapability("browserName", "safari");
  
  driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
  
  driver.get("https://www.google.co.in/?gfe_rd=cr&ei=hIcXVvjmMNT08wfkyr3YCg");
  
  WebDriverWait wait = new WebDriverWait(driver, 120);
  wait.until(ExpectedConditions.elementToBeClickable(By.name("q")));
  WebElement element = driver.findElement(By.name("q"));
  element.click();
  element.sendKeys("Testing");

}

}

e. Error i am getting from the console :

info: <-- POST /wd/hub/session 500 686.267 ms - 328
info: --> POST /wd/hub/session {“desiredCapabilities”:{“browserName”:“safari”,“platformName”:“iOS”,“deviceName”:“iPhone 6”,“platformVersion”:“9.0”}}
info: Client User-Agent string: Apache-HttpClient/4.5 (Java/1.8.0_25)
info: [debug] Configuring Safari session
info: [debug] We’re on iOS8+ so not copying mobile safari app
info: [debug] Creating new appium session 929403d2-a8b0-4e38-b213-52e155b3f67c
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode version
info: [debug] Xcode version set to 7.0
info: [debug] Setting iOS SDK Version
info: [debug] iOS SDK Version set to 9.0
info: [debug] Checking whether instruments supports our device string
info: [debug] Getting list of devices instruments supports
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.0”,“iOSSDKVersion”:“9.0”,“deviceName”:“iPhone 6”,“platformVersion”:“9.0”}
info: [debug] fixDevice is on
info: [debug] Fixing device. Changed from: “iPhone 6 (9.0)” to: “iPhone 6 (9.0) [”
info: [debug] Final device string is: ‘iPhone 6 (9.0) [’
error: Could not find a device to launch. You requested ‘iPhone 6 (9.0) [’, but the available devices were: []
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Could not find a device to launch. You requested ‘iPhone 6 (9.0) [’, but the available devices were: []
info: [debug] Error: Could not find a device to launch. You requested ‘iPhone 6 (9.0) [’, but the available devices were: []
at noDevicesError (/usr/local/lib/node_modules/appium/lib/devices/ios/ios.js:1140:10)
at [object Object]. (/usr/local/lib/node_modules/appium/lib/devices/ios/ios.js:1146:16)
at /usr/local/lib/node_modules/appium/node_modules/async/lib/async.js:522:46
at /usr/local/lib/node_modules/appium/node_modules/async/lib/async.js:251:17
at /usr/local/lib/node_modules/appium/node_modules/async/lib/async.js:148:21
at /usr/local/lib/node_modules/appium/node_modules/async/lib/async.js:248:21
at /usr/local/lib/node_modules/appium/node_modules/async/lib/async.js:612:34
at /usr/local/lib/node_modules/appium/node_modules/async/lib/async.js:513:25
at /usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:119:7
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Socket. (child_process.js:1183:11)
at Socket.emit (events.js:107:17)
at Pipe.close (net.js:485:12)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Could not find a device to launch. You requested ‘iPhone 6 (9.0) [’, but the available devices were: [])”,“origValue”:“Could not find a device to launch. You requested ‘iPhone 6 (9.0) [’, but the available devices were: []”},“sessionId”:null}

f. Also for android tests (5.0.2) i ran the same test that was working on 1.3.7 (Got the device id using adb devices). Error i see in the console
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: “/Users/sachin/Library/Android/sdk/platform-tools/adb” devices
info: [debug] 1 device(s) connected
info: Found device 464fda9f
info: [debug] Setting device id to 464fda9f
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: “/Users/sachin/Library/Android/sdk/platform-tools/adb” -s 464fda9f wait-for-device
info: [debug] executing cmd: “/Users/sachin/Library/Android/sdk/platform-tools/adb” -s 464fda9f shell “echo ‘ready’”
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn “/Users/sachin/Library/Android/sdk/platform-tools/adb” ENOENT
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: spawn “/Users/sachin/Library/Android/sdk/platform-tools/adb” ENOENT
info: [debug] Error: spawn “/Users/sachin/Library/Android/sdk/platform-tools/adb” ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickDomainCallback (node.js:381:11)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: spawn “/Users/sachin/Library/Android/sdk/platform-tools/adb” ENOENT)”,“code”:“ENOENT”,“errno”:“ENOENT”,“syscall”:“spawn “/Users/sachin/Library/Android/sdk/platform-tools/adb””,“path”:""/Users/sachin/Library/Android/sdk/platform-tools/adb"",“origValue”:“spawn “/Users/sachin/Library/Android/sdk/platform-tools/adb” ENOENT”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 97.251 ms - 434

For iOS:
You don’t have any simulator in machine create simulator and then try or use real device.

I have simulator that launches with xcode … I created a project in Xcode … Did Command-R and simulator launched … I have given this path in the appium (iOs Settings - App Path) … Snapshots attached below …
Is there any other way to create the simulator? I want to get it working on simulator first and then will try the real device also …


Do you have more than one Xcode installed on your machine???
If thats the case you need to select the one which has the simulators.

I have only one Xcode installed (7.0)

can you run instruments -s devices and show the output here.

instruments -s devices
Known Devices:
Sachin’s MacBook Pro [4DCC61A5-0F0F-5DD9-A469-B6D75BBAFD1C]
iPad 2 (9.0) [95E1A701-81C6-4223-967A-34F69ECC3B09]
iPad Air (9.0) [0DA82AAA-E4B1-44DB-BA9C-7582731E8950]
iPad Air 2 (9.0) [F94D6B96-9D8E-4AF5-8804-CFC365D3926A]
iPad Retina (9.0) [7667B445-2977-4951-8857-FA18E7853D3D]
iPhone 4s (9.0) [BF781024-DD67-4CF7-80DF-F382753167A8]
iPhone 5 (9.0) [7EC92170-3CC9-4B3F-9779-579D7904F099]
iPhone 5s (9.0) [B3CF271F-4C37-4C5F-9C08-E56C93689FF4]
iPhone 6 (9.0) [42DF997D-8841-45EE-BCB8-083CC4109FA0]
iPhone 6 (9.0) + Apple Watch - 38mm (2.0) [828DA58C-B71A-4E16-8B39-7D1319A7655F]
iPhone 6 Plus (9.0) [19A00F53-3329-4C48-88DC-086CB55D3AF5]
iPhone 6 Plus (9.0) + Apple Watch - 42mm (2.0) [C5825F5E-4106-4FB0-B2C7-C2BF4B2623E7]
iPhone 6s (9.0) [7557AE92-AE5B-4454-A97C-C28C1BDE1DF0]
iPhone 6s Plus (9.0) [92EB023D-7361-4C47-A4BD-718D9DB69636]

I hope you had enabled iOS_debug_webkit_proxy.

I followed the steps - Built-in ios-webkit-debug-proxy server? and https://github.com/appium/appium/issues/5309 to enable this proxy. Still didn’t launch the Simulator. Steps below :

Also installed iOS_debug_webkit_proxy from brew.
Tried 2 options below to enable this proxy :

./bin/ios-webkit-debug-proxy-launcher.js -c 42DF997D-8841-45EE-BCB8-083CC4109FA0:27753 -d

RUNNING: ios_webkit_debug_proxy -c 42DF997D-8841-45EE-BCB8-083CC4109FA0:27753 -d
stderr: Unknown file: 42DF997D-8841-45EE-BCB8-083CC4109FA0:27753
stderr: Unknown file: 42DF997D-8841-45EE-BCB8-083CC4109FA0:27753

ios_webkit_debug_proxy -c 42DF997D-8841-45EE-BCB8-083CC4109FA0:27753
Unknown file: 42DF997D-8841-45EE-BCB8-083CC4109FA0:27753
Unknown file: 42DF997D-8841-45EE-BCB8-083CC4109FA0:27753

Also error in the Eclipse Console is (After running this : node bin/appium.js -U )

Original error: ENOENT, stat '/usr/local/lib/node_modules/appium/appium/build/SafariLauncher/SafariLauncher.zip

I got the Device ID as shown in the snapshot below :

This error comes when browserName is chosen as a safari

To add further i did the following (Appreciate any help to solve this issue) :

Ran ./reset.sh --ios --real-safari –launcher --verbose

Check dependencies
Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) were found.

This is what i see in my Xcode project - Build and Target Settings (snapshot)

and this is what i see in the Preferences - View details

@pr4bh4sh
When i run the same command (instruments -s devices) from /usr/local/lib/node_modules/appium/appium, i see only 3 devices (one my macbook and 2 apple watch)

Is this the reason why simulator isnt launching? Can you please help solve this?

Sachin’s MacBook Pro [4DCC61A5-0F0F-5DD9-A469-B6D75BBAFD1C]
Apple Watch - 38mm (2.0) [A77489F0-A13E-4C44-AFC7-F6B60DFFC6DD]
Apple Watch - 42mm (2.0) [B021ACF8-4057-47FA-9DB9-87ABDBAE8C2F]

Using UUID for the above apple watch tries to open 3 times and then i get the error - A new session could not be created. (Original error: Instruments crashed on startup)

I Continued trying and finally everything is solved

I uninstalled npm,node etc
Installed them again with brew (this is the key step). I then installed Appium (1.4.16) using brew without sudo

Now i am able to run my previous android tests as well as iphone simulator (Including Safari browser). No need to configure anything in the Appium UI, just started appium with appium &

All people on group please use the latest version 1.4.16, 1.4.13 gave me a tough time :joy: