Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用模拟器让Appium在Mac上运行以实现移动web自动化_C#_Ios_Selenium_Mobile Safari_Appium - Fatal编程技术网

C# 如何使用模拟器让Appium在Mac上运行以实现移动web自动化

C# 如何使用模拟器让Appium在Mac上运行以实现移动web自动化,c#,ios,selenium,mobile-safari,appium,C#,Ios,Selenium,Mobile Safari,Appium,我是Windows的长期用户,但我的任务是为我的公司在MAC上实现移动自动化 我正在使用Windows与Visual Studio和C#一起编写自动化脚本。我能够在本地针对Chrome、Firefox、IE和Android运行使用selenium的web应用程序。我正试图在我刚收到的MacBook Pro上运行,以便在iOS模拟器上对Safari运行selenium测试。这是我第一次使用Mac电脑,所以我对该平台上的工作方式一点也不熟悉。一旦我们搞清楚了移动网络,我还需要研究本地应用 我在Mac

我是Windows的长期用户,但我的任务是为我的公司在MAC上实现移动自动化

我正在使用Windows与Visual Studio和C#一起编写自动化脚本。我能够在本地针对Chrome、Firefox、IE和Android运行使用selenium的web应用程序。我正试图在我刚收到的MacBook Pro上运行,以便在iOS模拟器上对Safari运行selenium测试。这是我第一次使用Mac电脑,所以我对该平台上的工作方式一点也不熟悉。一旦我们搞清楚了移动网络,我还需要研究本地应用

我在Mac上的设置是:

  • OS X El Capitan版本10.11.3
  • MacBook Pro(视网膜,15英寸)
  • 2.5GHz Intel Core i7,16GB DDR3
  • AMD Radeon R9 M370X 2048MB
  • Xcode 7.2.1(7C1002),具有Apple开发者许可证(下载所有可用模拟器)
  • Appium 1.4.13(Draco)通过从Appium.io下载的dmg安装

当我运行Appium Doctor时,我得到以下信息:

Last login: Mon Feb 22 14:34:40 on ttys000
'/Applications/Appium.app/Contents/Resources/node/bin/node' '/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium-doctor.js'
declare -x Apple_PubSub_Socket_Render="/private/tmp/com.apple.launchd.ukLStu96DF/Render"
declare -x HOME="/Users/testingpractice"
declare -x LANG="en_US.UTF-8"
declare -x LOGNAME="testingpractice"
declare -x OLDPWD
declare -x PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
declare -x PWD="/Users/testingpractice"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.PMzTbRwztS/Listeners"
declare -x TERM="xterm-256color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="361.1"
declare -x TERM_SESSION_ID="F4E1362D-F932-4505-86CE-09EEA71355CA"
declare -x TMPDIR="/var/folders/k7/gpwg274d4lj0hfb912nt7ych0000gp/T/"
declare -x USER="testingpractice"
declare -x XPC_FLAGS="0x0"
declare -x XPC_SERVICE_NAME="0"
declare -x _CFUSER_TEXT_ENCODING="0x1F6:0x0:0x0"
Automation-MacBook-Pro:~ testingpractice$ '/Applications/Appium.app/Contents/Resources/node/bin/node' '/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium-doctor.js'
Running iOS Checks
✔ Xcode is installed at /Applications/Xcode.app/Contents/Developer
✔ Xcode Command Line Tools are installed.
✔ DevToolsSecurity is enabled.
✔ The Authorization DB is set up properly.
✔ Node binary found at /usr/local/bin/node
✔ iOS Checks were successful.

Running Android Checks
✖ ANDROID_HOME is not set
Appium-Doctor detected problems. Please fix and rerun Appium-Doctor.
Automation-MacBook-Pro:~ testingpractice$ 
public static DesiredCapabilities GetiOS() {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("browserName", "Safari");
capabilities.SetCapability("deviceName", "iPhone 6s");
capabilities.SetCapability("platformVersion", "9.2");
capabilities.SetCapability("platformName", "iOS");
return capabilities;
}

public static class DriverManager {
private static IOSDriver driver;
public static IOSDriver CurrentDriver { get { return driver; } set { driver = value; } }

    public static void SetDriver(DesiredCapabilities capabilities) {
        Uri serverUri = new Uri("http://192.168.1.8:4723/wd/hub");   // 192.168.1.8 is address for MacBook
        driver = new IOSDriver<IWebElement>(serverUri, capabilities, TimeSpan.FromSeconds(180));
        driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
    }
}
我不太担心Android不能正常工作,因为我从来没有计划在这台机器上运行Android

这是我的仪器的输出,据我所知只是一个模拟器列表:

Automation-MacBook-Pro:~ testingpractice$ instruments -s devices
Known Devices:
Apple TV 1080p (9.1) [DD55AC17-2D35-4EF5-8821-021E15A52F65]
iPad 2 (8.1) [C68FE9A4-5C65-4521-AD14-D773E8C7B8AC]
iPad 2 (9.1) [5D5244BC-2478-4F32-A798-C6C94789F3BE]
iPad 2 (9.2) [517E3088-A34A-4E7A-A978-45DA5AC24EAC]
iPad Air (8.1) [34E1D53C-7B31-4FF0-ADF5-DB82A0AC6079]
iPad Air (9.1) [221C9A90-21A2-467B-B725-52FBBEC92240]
iPad Air (9.2) [B850405B-F7DA-46E1-BB34-3667B9565906]
iPad Air 2 (9.1) [FDE03DDE-06F0-4FC2-9A93-0F14D96C7FAB]
iPad Air 2 (9.2) [84DC9A1A-4CDC-4390-8E48-47267ACF1E68]
iPad Pro (9.1) [3516A910-4740-40C2-9826-68E4859036B6]
iPad Pro (9.2) [8E63ABBE-85E2-4571-9B5D-9CE7E6E37960]
iPad Retina (8.1) [314D4BFE-E5FA-423D-8711-C17A37131837]
iPad Retina (9.1) [B19AE619-5C11-42DD-9B99-6AAF2E22CAE0]
iPad Retina (9.2) [5C180837-EB8A-4BD3-AE55-BCFB56046BE8]
iPhone 4s (8.1) [97D6F764-A4C2-4B69-9E93-96AC9AC5862C]
iPhone 4s (9.1) [077C14B9-BBDF-4E21-B02B-93C85AD5D70B]
iPhone 4s (9.2) [AE5DFBE3-DC98-4F30-AF21-ABB60B5B9A64]
iPhone 5 (8.1) [FFEAB284-1DF7-4B6C-980E-5F1128B2368E]
iPhone 5 (9.1) [21F8B48E-E02B-415C-B15A-5C96A7E00C27]
iPhone 5 (9.2) [AA38A59C-0D76-4292-909E-A5E21113FE1E]
iPhone 5s (8.1) [779EEDFE-916C-462B-B44C-F529C95BB7DF]
iPhone 5s (9.1) [A31E4BD0-427B-47F2-8E48-01D51CB59808]
iPhone 5s (9.2) [D8062708-283E-4AB5-BC38-317F9028E466]
iPhone 6 (8.1) [62A99757-A87B-4DC0-AE76-E08BA56DDC93]
iPhone 6 (9.1) [0AA3180A-D630-4853-B939-FAE21C22CD7D]
iPhone 6 (9.2) [CFD81446-E1C0-40FC-89A1-2EE0F3724F72]
iPhone 6 Plus (8.1) [F5F124FE-26FD-41DE-81C7-85B7F8ED71B0]
iPhone 6 Plus (9.1) [5D65190C-94CB-4D9B-9BA1-D8E8CF704BEE]
iPhone 6 Plus (9.2) [5541221D-B804-445F-871F-4C8863F53A29]
iPhone 6s (9.1) [99D7AB63-FC39-4667-BBB5-94ACF58ED0B5]
iPhone 6s (9.2) [120C48AA-EC78-462C-AD39-ED439387AF1C]
iPhone 6s (9.2) + Apple Watch - 38mm (2.1) [B49CF332-0190-4F07-9BD5-3BDE2D3D170C]
iPhone 6s Plus (9.1) [CCC8C7FD-31C3-488E-BCEE-8DFA6E142688]
iPhone 6s Plus (9.2) [89FB91D6-D08C-4328-95DD-AC706131E7A7]
iPhone 6s Plus (9.2) + Apple Watch - 42mm (2.1) [C7364101-BA43-4FBE-A8B3-567C79B23B59]
Automation-MacBook-Pro:~ testingpractice$ 
我的测试脚本使用以下内容:

Last login: Mon Feb 22 14:34:40 on ttys000
'/Applications/Appium.app/Contents/Resources/node/bin/node' '/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium-doctor.js'
declare -x Apple_PubSub_Socket_Render="/private/tmp/com.apple.launchd.ukLStu96DF/Render"
declare -x HOME="/Users/testingpractice"
declare -x LANG="en_US.UTF-8"
declare -x LOGNAME="testingpractice"
declare -x OLDPWD
declare -x PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
declare -x PWD="/Users/testingpractice"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.PMzTbRwztS/Listeners"
declare -x TERM="xterm-256color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="361.1"
declare -x TERM_SESSION_ID="F4E1362D-F932-4505-86CE-09EEA71355CA"
declare -x TMPDIR="/var/folders/k7/gpwg274d4lj0hfb912nt7ych0000gp/T/"
declare -x USER="testingpractice"
declare -x XPC_FLAGS="0x0"
declare -x XPC_SERVICE_NAME="0"
declare -x _CFUSER_TEXT_ENCODING="0x1F6:0x0:0x0"
Automation-MacBook-Pro:~ testingpractice$ '/Applications/Appium.app/Contents/Resources/node/bin/node' '/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium-doctor.js'
Running iOS Checks
✔ Xcode is installed at /Applications/Xcode.app/Contents/Developer
✔ Xcode Command Line Tools are installed.
✔ DevToolsSecurity is enabled.
✔ The Authorization DB is set up properly.
✔ Node binary found at /usr/local/bin/node
✔ iOS Checks were successful.

Running Android Checks
✖ ANDROID_HOME is not set
Appium-Doctor detected problems. Please fix and rerun Appium-Doctor.
Automation-MacBook-Pro:~ testingpractice$ 
public static DesiredCapabilities GetiOS() {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("browserName", "Safari");
capabilities.SetCapability("deviceName", "iPhone 6s");
capabilities.SetCapability("platformVersion", "9.2");
capabilities.SetCapability("platformName", "iOS");
return capabilities;
}

public static class DriverManager {
private static IOSDriver driver;
public static IOSDriver CurrentDriver { get { return driver; } set { driver = value; } }

    public static void SetDriver(DesiredCapabilities capabilities) {
        Uri serverUri = new Uri("http://192.168.1.8:4723/wd/hub");   // 192.168.1.8 is address for MacBook
        driver = new IOSDriver<IWebElement>(serverUri, capabilities, TimeSpan.FromSeconds(180));
        driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
    }
}
publicstaticdesireedcapabilities GetiOS(){
DesiredCapabilities=新的DesiredCapabilities();
能力。设置能力(“浏览器名”、“Safari”);
设置功能(“deviceName”、“iPhone 6s”);
能力。设置能力(“平台版”、“9.2”);
能力。设置能力(“平台名”、“iOS”);
返回能力;
}
公共静态类DriverManager{
专用静态IOS驱动程序;
公共静态IOSDriver CurrentDriver{get{return driver;}set{driver=value;}}
公共静态void SetDriver(DesiredCapabilities){
Uri serverUri=新Uri(“http://192.168.1.8:4723/wd/hub“”;//192.168.1.8是MacBook的地址
driver=新的IOSDriver(serverUri,能力,TimeSpan.FromSeconds(180));
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
}
}
我在Appium中获得以下输出:

Launching Appium with command: '/Applications/Appium.app/Contents/Resources/node/bin/node' lib/server/main.js --command-timeout "7200" --debug-log-spacing --platform-version "9.2" --platform-name "iOS" --show-ios-log --default-device

declare -x Apple_PubSub_Socket_Render="/private/tmp/com.apple.launchd.ukLStu96DF/Render"
declare -x HOME="/Users/testingpractice"
declare -x LOGNAME="testingpractice"
declare -x OLDPWD
declare -x PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
declare -x PWD="/Applications/Appium.app/Contents/Resources/node_modules/appium"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.PMzTbRwztS/Listeners"
declare -x TMPDIR="/var/folders/k7/gpwg274d4lj0hfb912nt7ych0000gp/T/"
declare -x USER="testingpractice"

declare -x XPC_FLAGS="0x0"
declare -x XPC_SERVICE_NAME="com.appium.Appium.138912"
declare -x _CFUSER_TEXT_ENCODING="0x1F6:0x0:0x0"

info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)

info: Appium REST http interface listener started on 0.0.0.0:4723

info: [debug] Non-default server args: {"platformName":"iOS","platformVersion":"9.2","defaultDevice":true,"showIOSLog":true,"defaultCommandTimeout":7200,"debugLogSpacing":true}

info: Console LogLevel: debug

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}

info: <-- GET /wd/hub/status 200 6.623 ms - 105 {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}

info: <-- GET /wd/hub/status 200 2.038 ms - 105 {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}

info: --> POST /wd/hub/session {"desiredCapabilities":{"browserName":"Safari","deviceName":"iPhone 6s","platformVersion":"9.2","platformName":"iOS"}}

info: Client User-Agent string: undefined
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***

info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: [debug] Configuring Safari session
info: [debug] We're on iOS8+ so not copying mobile safari app
info: [debug] Creating new appium session 86528c8f-a57d-484d-8c5d-0272b7688b37
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.2.1

info: [debug] Setting iOS SDK Version

info: [debug] iOS SDK Version set to 9.2
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.2.1","iOSSDKVersion":"9.2","deviceName":"iPhone 6s","platformVersion":"9.2"}

info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 6s (9.2)'
info: [debug] iOS sim UDID is B49CF332-0190-4F07-9BD5-3BDE2D3D170C
info: [debug] Auto-detecting iOS udid...
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Localizable.strings is not currently supported when using real devices.
info: [debug] Creating instruments

info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/testingpractice/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {"nodePath":"/Applications/Appium.app/Contents/Resources/node/bin/node","commandProxyClientPath":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-uiauto/bin/command-proxy-client.js","instrumentsSock":"/tmp/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"oneByOne"}
info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
...
info: [debug] Dynamic bootstrap path: /Users/testingpractice/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js
info: [debug] Reusing dynamic bootstrap: /Users/testingpractice/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"7.2.1","iOSSDKVersion":"9.2","deviceName":"iPhone 6s","platformVersion":"9.2"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 6s (9.2)'
info: [debug] Not setting device type since we're using bundle ID and assuming app is already installed
info: [debug] Checking whether we need to set app preferences
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process

info: [debug] Killing any other simulator daemons

info: [debug] Cleaning sim data files
info: node-simctl: Executing: xcrun with args: simctl erase B49CF332-0190-4F07-9BD5-3BDE2D3D170C and timeout: 2000

info: [debug] Killall iOS Simulator

info: [debug] Cleaning mobile safari data files

warn: Applications directory /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Containers/Data/Application doesn't exist. Have you run this simulator before?

info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Caches/Snapshots/com.apple.mobilesafari
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Caches/com.apple.mobilesafari/Cache.db*
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Caches/com.apple.WebAppCache/*.db
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Safari
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/WebKit/LocalStorage/*.*

info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/WebKit/GeolocationSites.plist
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Cookies/*.binarycookies
info: [debug] Not setting locale
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS 8.* simulator log capture

info: [debug] Not pre-launching simulator

info: [debug] Starting command proxy.
info: [debug] Instruments socket server started at /tmp/instruments_sock
info: [debug] Starting instruments
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6s (9.2)
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6s (9.2)" com.apple.mobilesafari -e UIASCRIPT "/Users/testingpractice/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {"global":90000}

info: [debug] [INSTSERVER] Instruments exited with code null
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #1
info: [debug] [INST STDERR] dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x109EFF000, size=0x00001000 segment=_TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/nodemodules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on iPhone 6s (9.2)

info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6s (9.2)" com.apple.mobilesafari -e UIASCRIPT "/Users/testingpractice/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INSTSERVER] Instruments exited with code null
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #2
info: [debug] [INST STDERR] dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x108593000, size=0x00001000 segment=_TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/nodemodules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on iPhone 6s (9.2)
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6s (9.2)" com.apple.mobilesafari -e UIASCRIPT "/Users/testingpractice/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js" -e UIARESULTSPATH /tmp/appium-instruments

info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INSTSERVER] Instruments exited with code null
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #3
info: [debug] [INST STDERR] dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x101CF2000, size=0x00001000 segment=_TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/nodemodules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on iPhone 6s (9.2)
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6s (9.2)" com.apple.mobilesafari -e UIASCRIPT "/Users/testingpractice/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7"}

info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INSTSERVER] Instruments exited with code null
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch
info: [debug] Stopping iOS log capture
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killing any other simulator daemons
info: [debug] [INST STDERR] dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x10949C000, size=0x00001000 segment=_TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/nodemodules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

info: [debug] Killall iOS Simulator

info: [debug] Cleaning sim data files
info: node-simctl: Executing: xcrun with args: simctl erase B49CF332-0190-4F07-9BD5-3BDE2D3D170C and timeout: 2000

info: [debug] Cleaning mobile safari data files

warn: Applications directory /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Containers/Data/Application doesn't exist. Have you run this simulator before?
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Caches/Snapshots/com.apple.mobilesafari

error: Failed to start an Appium session, err was: Error: Instruments crashed on startup

info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Caches/com.apple.mobilesafari/Cache.db*
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Caches/com.apple.WebAppCache/*.db
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Safari
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/WebKit/LocalStorage/*.*
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/WebKit/GeolocationSites.plist
info: [debug] Deleting /Users/testingpractice/Library/Developer/CoreSimulator/Devices/B49CF332-0190-4F07-9BD5-3BDE2D3D170C/data/Library/Cookies/*.binarycookies
info: [debug] Cleaning up appium session
info: [debug] Error: Instruments crashed on startup
at [object Object].Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:440:31)
at [object Object]. (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:353:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess.handle.onexit (childprocess.js:1074:12)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}
info: <-- POST /wd/hub/session 500 16032.755 ms - 182

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}

info: <-- GET /wd/hub/status 200 0.903 ms - 105 {"status":0,"value":{"build":{"version":"1.4.13","revision":"c75d8adcb66a75818a542fe1891a34260c21f76a"}}}
使用以下命令启动Appium:'/Applications/Appium.app/Contents/Resources/node/bin/node'lib/server/main.js--命令超时“7200”--调试日志间隔--平台版本“9.2”--平台名称“iOS”--显示iOS日志--默认设备
声明-x Apple_PubSub_Socket_Render=“/private/tmp/com.Apple.launchd.ukLStu96DF/Render”
declare-x HOME=“/Users/testingpractice”
declare-x LOGNAME=“测试实践”
声明-x OLDPWD
declare-x PATH=“/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin”
declare-x PWD=“/Applications/Appium.app/Contents/Resources/node_modules/Appium”
declare-x SHELL=“/bin/bash”
声明-x SHLVL=“1”
declare-x SSH_AUTH_SOCK=“/private/tmp/com.apple.launchd.PMzTbRwztS/Listeners”
declare-x TMPDIR=“/var/folders/k7/gpwg274d4lj0hfb912nt7ych0000gp/T/”
declare-x USER=“testingpractice”
声明-x XPC_标志=“0x0”
declare-x XPC_SERVICE_NAME=“com.appium.appium.138912”
声明-x\u CFUSER\u TEXT\u ENCODING=“0x1F6:0x0:0x0”
信息:欢迎使用Appium v1.4.13(版本c75d8adcb66a75818a542fe1891a34260c21f76a)
信息:Appium REST http接口侦听器于0.0.0.0:4723启动
信息:[调试]非默认服务器参数:{“platformName”:“iOS”,“platformVersion”:“9.2”,“defaultDevice”:true,“showIOSLog”:true,“defaultCommandTimeout”:7200,“debugLogSpacing”:true}
信息:控制台日志级别:调试
信息:-->GET/wd/hub/status{}
信息:[调试]成功响应客户端:{“状态”:0,“值”:{“生成”:{“版本”:“1.4.13”,“修订版”:“c75d8adcb66a75818a542fe1891a34260c21f76a”}
信息:GET/wd/hub/status{}
信息:[调试]成功响应客户端:{“状态”:0,“值”:{“生成”:{“版本”:“1.4.13”,“修订版”:“c75d8adcb66a75818a542fe1891a34260c21f76a”}
信息:POST/wd/hub/session{“desiredCapabilities”:{“browserName”:“Safari”,“deviceName”:“iPhone 6s”,“platformVersion”:“9.2”,“platformName”:“iOS”}
信息:客户端用户代理字符串:未定义
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:***新会话***
信息:***新会话***
信息:***新会话***
信息:***新会话***
信息:***新会话***
信息:***新会话***
信息:***新会话***
信息:***新会话***
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:*************************************
信息:[调试]配置Safari会话
信息:[调试]我们在iOS8+上,因此没有复制移动safari应用程序
信息:[调试]创建新的应用程序会话86528c8f-a57d-484d-8c5d-0272b7688b37
信息:[调试]删除所有剩余的仪器插座
信息:[调试]已清理仪器插座/tmp/instruments\u插座
信息:[调试]正在设置Xcode版本
信息:[调试]Xcode版本设置为7.2.1
信息:[调试]正在设置iOS SDK版本
信息:[调试]iOS SDK版本设置为9.2
信息:[调试]检查仪器是否支持我们的设备字符串
信息:[调试]正在获取仪器支持的设备列表
信息:[调试]仪器位于:/Applications/Xcode.app/Contents/Developer/usr/bin/Instruments
信息:[调试]从选项获取设备字符串:{“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.2.1”,“iOSSDKVersion”:“9.2”,“deviceName”:“iPhone 6s”,“platformVersion”:“9.2”}
信息:[调试]修复设备已打开
信息:[调试]最后一个设备字符串是:“iPhone 6s(9.2)”
信息:[黛布