Hi All,
I have a automation requirement that I need to get some value from settings in iOS(iphone&ipad), I am a new Appium guy, anybody can tell me how to do ?
Thank you very much. I followed video, but my code still not works fine, I will check it continue. thanks again
I have tried it on real device follow the video, and met a issue as below.
Code:
import java.net.URL;
import io.appium.java_client.AppiumDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
public class Main {
public static void main(String[] args) throws Exception {
AppiumDriver driver;
DesiredCapabilities ca = new DesiredCapabilities();
ca.setCapability(âplatformNameâ, âiOSâ);
ca.setCapability(âdeviceNameâ, âiPhone4â);
ca.setCapability(âplatformVersionâ, â7.1â);
ca.setCapability(âudidâ, myudid);
ca.setCapability(âappâ, âsettingsâ);
URL url = new URL(âhttp://127.0.0.1:4723/wd/hubâ);
driver = new AppiumDriver(url, ca);
Error:
Detail response:
info: --> POST /wd/hub/session {âdesiredCapabilitiesâ:{âappâ:âcom.apple.Preferencesâ,âplatformVersionâ:â7.1â,âdeviceNameâ:âiPhone4â,âplatformNameâ:âiOSâ,âudidâ:âd604d9e7a8b3907e1c2a9e071ea7b242823f6eb6â}}
info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
info: [debug] App is an iOS bundle, will attempt to run as pre-existing
info: [debug] Creating new appium session 4ec9788d-b5f9-42d3-9d48-b6471556b604
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder
info: [debug] Setting Xcode version
info: [debug] Setting iOS SDK Version
info: [debug] Getting sdk version from xcrun with a timeout
info: [debug] iOS SDK Version set to 7.1
info: [debug] Not checking whether simulator is available since weâre on a real device
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Could not parse plist file (as binary) at /Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/com.apple.Preferences/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML
info: [debug] Could not parse plist file (as XML) at /Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/com.apple.Preferences/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings; assuming it doesnât exist
info: [debug] Creating instruments
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/andy/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {ânodePathâ:"/Volumes/Appium/Appium.app/Contents/Resources/node/bin/node",âcommandProxyClientPathâ:"/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js",âinstrumentsSockâ:"/tmp/instruments_sock",âinterKeyDelayâ:null,âjustLoopInfinitelyâ:false,âautoAcceptAlertsâ:false,âsendKeyStrategyâ:âgroupedâ}
info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
âŚ
info: [debug] Dynamic bootstrap path: /Users/andy/Library/Application Support/appium/bootstrap/bootstrap-e7c762ee10bfa027.js
info: [debug] Reusing dynamic bootstrap: /Users/andy/Library/Application Support/appium/bootstrap/bootstrap-e7c762ee10bfa027.js
info: [debug] Getting device string from opts: {âforceIphoneâ:false,âforceIpadâ:false,âxcodeVersionâ:â5.1.1â,âiOSSDKVersionâ:â7.1â,âdeviceNameâ:âiPhone4â,âplatformVersionâ:â7.1â}
info: [debug] fixDevice is on
info: [debug] Fixing device. Changed from: âiPhone - Simulator - iOS 7.1â to: âiPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1â
info: [debug] Final device string is: âiPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1â
info: [debug] Not setting device type since weâre on a real device
info: [debug] Checking whether we need to set app preferences
info: [debug] Not setting iOS and app preferences since weâre on a real device
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killall iPhoneSimulator
info: [debug] Killing any other simulator daemons
info: [debug] On a real device; cannot clean device state
info: [debug] Not setting locale because weâre using a real device
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS device log capture via deviceconsole
info: [debug] Not pre-launching simulator
info: [debug] Creating iDevice object with udid d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6
info: [debug] Couldnât find ideviceinstaller, trying built-in at /Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
info: [debug] Checking app install status using: /Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6 --bundle com.apple.Preferences
info: [debug] App is installed.
info: [debug] fullReset not requested. No need to install.
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 real device with UDID d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6
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.bundle/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6 com.apple.Preferences -e UIASCRIPT â/Users/andy/Library/Application Support/appium/bootstrap/bootstrap-e7c762ee10bfa027.jsâ -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {âglobalâ:90000}
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:18 iPhone-4 DTMobileIS[3513] : Could not create service named com.apple.instruments.server.services.filebrowser
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:18 iPhone-4 DTMobileIS[3513] : Could not create service named com.apple.instruments.server.services.launchdaemon
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:18 iPhone-4 DTMobileIS[3513] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
info: [debug] [INST STDERR] 2015-01-30 11:30:19.926 instruments[2625:507] unable to locate CFBundleIdentifier for path: com.apple.Preferences
info: [debug] [INST STDERR] Instruments Trace Error : Error Starting Recording
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #1
info: [debug] Killall iPhoneSimulator
info: Launching instruments
info: [debug] Attempting to run app on real device with UDID d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6
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.bundle/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6 com.apple.Preferences -e UIASCRIPT â/Users/andy/Library/Application Support/appium/bootstrap/bootstrap-e7c762ee10bfa027.jsâ -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {âglobalâ:90000}
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:24 iPhone-4 mstreamd[3512] : (Note ) mstreamd: Not monitoring for external power.
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:24 iPhone-4 mstreamd[3512] : (Note ) PS: Media stream daemon stopping.
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:24 iPhone-4 mstreamd[3512] : (Note ) AS: <MSIOSAlbumSharingDaemon: 0x17562b90>: Shared Streams daemon has shut down.
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:24 iPhone-4 mstreamd[3512] : (Warn ) mstreamd: mstreamd shutting down.
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:24 iPhone-4 mstreamd[3514] : (Note ) mstreamd: mstreamd starting up.
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:24 iPhone-4 mstreamd[3514] : (Note ) PS: Media stream daemon startingâŚ
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:25 iPhone-4 DTMobileIS[3515] : Could not create service named com.apple.instruments.server.services.filebrowser
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:25 iPhone-4 DTMobileIS[3515] : Could not create service named com.apple.instruments.server.services.launchdaemon
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:25 iPhone-4 DTMobileIS[3515] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
info: [debug] [INST STDERR] 2015-01-30 11:30:27.076 instruments[2628:507] unable to locate CFBundleIdentifier for path: com.apple.Preferences
info: [debug] [INST STDERR] Instruments Trace Error : Error Starting Recording
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #2
info: [debug] Killall iPhoneSimulator
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:31 iPhone-4 mDNSResponder[33] : DeregisterInterface: Frequent transitions for interface en0 (10.100.10.120)
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:31 iPhone-4 mDNSResponder[33] : mDNS_RegisterInterface: Frequent transitions for interface en0 (FE80:0000:0000:0000:049B:119E:0757:444A)
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:31 iPhone-4 kernel[0] : en0: BSSID changed to b0:00:b4:fa:b1:83
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:31 iPhone-4 kernel[0] : en0::IO80211Interface::postMessage bssid changed
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:31 iPhone-4 kernel[0] : 083794.439762 wlan.N[6861] [bringUpLink] AppleBCMWLAN Left BSS(up): @0x809dea00 BSSID=b0:00:b4:fa:b1:83 rssi=-48 snr= 0 rate=54 (100%) channel= 1 encryption=0x8 ap=1 failures= 0 age=1477 ssid[11]=âclouddeviceâ
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:31 iPhone-4 kernel[0] : 083794.439923 wlan.N[6862] [bringUpLink] AppleBCMWLAN Roamed to BSS: @0x809d9c00 BSSID=28:34:a2:32:54:13 rssi=-61 snr= 0 rate=54 (100%) channel=11 encryption=0x8 ap=1 failures= 0 age=1132 ssid[11]=âclouddeviceâ
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:31 iPhone-4 kernel[0] : en0: BSSID changed to 28:34:a2:32:54:13
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:31 iPhone-4 kernel[0] : en0::IO80211Interface::postMessage bssid changed
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:31 iPhone-4 mDNSResponder[33] : mDNS_RegisterInterface: Frequent transitions for interface en0 (10.100.10.120)
info: Launching instruments
info: [debug] Attempting to run app on real device with UDID d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6
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.bundle/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6 com.apple.Preferences -e UIASCRIPT â/Users/andy/Library/Application Support/appium/bootstrap/bootstrap-e7c762ee10bfa027.jsâ -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {âglobalâ:90000}
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:32 iPhone-4 DTMobileIS[3516] : Could not create service named com.apple.instruments.server.services.filebrowser
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:32 iPhone-4 DTMobileIS[3516] : Could not create service named com.apple.instruments.server.services.launchdaemon
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:32 iPhone-4 DTMobileIS[3516] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
info: [debug] [INST STDERR] 2015-01-30 11:30:34.194 instruments[2632:507] unable to locate CFBundleIdentifier for path: com.apple.Preferences
info: [debug] [INST STDERR] Instruments Trace Error : Error Starting Recording
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #3
info: [debug] Killall iPhoneSimulator
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:35 iPhone-4 lockdownd[53] : 00201000 _select_socket: receive secure message timeout!
info: Launching instruments
info: [debug] Attempting to run app on real device with UDID d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6
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.bundle/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w d604d9e7a8b3907e1c2a9e071ea7b242823f6eb6 com.apple.Preferences -e UIASCRIPT â/Users/andy/Library/Application Support/appium/bootstrap/bootstrap-e7c762ee10bfa027.jsâ -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {âglobalâ:90000}
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:40 iPhone-4 DTMobileIS[3517] : Could not create service named com.apple.instruments.server.services.filebrowser
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:40 iPhone-4 DTMobileIS[3517] : Could not create service named com.apple.instruments.server.services.launchdaemon
info: [IOS_SYSLOG_ROW ] Jan 30 11:30:40 iPhone-4 DTMobileIS[3517] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
info: [debug] [INST STDERR] 2015-01-30 11:30:41.935 instruments[2635:507] unable to locate CFBundleIdentifier for path: com.apple.Preferences
info: [debug] [INST STDERR] Instruments Trace Error : Error Starting Recording
info: [debug] [INSTSERVER] Instruments exited with code 253
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] Killall iPhoneSimulator
info: [debug] Killing any other simulator daemons
info: [debug] On a real device; cannot clean device state
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: [debug] Cleaning up appium session
info: [debug] Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:387:31)
at null. (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:308:12)
at ChildProcess.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:820: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 26241.652 ms - 182
info: --> GET /wd/hub/status {}
info: [debug] Responding to client with success: {âstatusâ:0,âvalueâ:{âbuildâ:{âversionâ:â1.3.4â,ârevisionâ:âc8c79a85fbd6870cd6fc3d66d038a115ebe22efeâ}}}
info: <-- GET /wd/hub/status 200 1.216 ms - 104 {âstatusâ:0,âvalueâ:{âbuildâ:{âversionâ:â1.3.4â,ârevisionâ:âc8c79a85fbd6870cd6fc3d66d038a115ebe22efeâ}}}
@Andy_Zhao :- I never tried on real IOS device, So I donât have any idea, But can you try on simulator once and check weather it is working for you or not.
Are you able to execute any other script on your real device?
Hi @Appium_Master,
thanks for your great help.
- Yes, I have ran other scripts in real devices
- I found a doc and indicate that we only can access settings page in simulator.
any update?
thanks
Andy
Just to let you know, guys. You can also run other iOS system apps using bundleId capability. Here is the list of available apps: http://stackoverflow.com/questions/9910366/what-is-the-bundle-identifier-of-apples-default-applications-in-ios
hi @sofa,
thank you very much.
these iOS system apps can be ran in real device ? or it just can be run in simulator ?
I have tried to run it in real device, but failed.
Honestly havenât tried that on real device yet.
Hi Andy,
I am facing the same issue while trying to run my tests against IOS real device. Are you able to solve the problem and if yes can you share with me your findings? Thanks!
Regards,
Ching
I dont think its possible.
Tried to do it and got the
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: Permission to debug com.apple.Preferences was denied. The app must be signed with a development identity (e.g. iOS Developer).
But hope to see that theres a workaround for it.
Only work around that I know off, is using TouchAction to make some script to change whatever you want to change on settings
I need to access the ios reminder app in the real device.
Reminder is set in the reminder app from the native app that I am testing.
Can i access ios reminder app and get the list of list of reminders from appium?
I am using appium 1.6.3
How would you change the WIFI options ? I was able to successfully open settings app and click on Wifi heading but when i tried to select which Wifi I wanted to select, I was not able to do so.
Hi,
Can you please tell me how you could open the settings page on real device?
I could do it on Simulator but when I try it on real device, I could find this from the Appium logs:
[debug] [XCUITest] Cannot find xcodebuildâs process id, so unable to retrieve DerivedData folder path
[XCUITest] No WebDriverAgent derived data available, so unable to set permissions on WDA attachments folder
Yes we can do it for real devices
Add one capability âappâ,âSettingsâ
yes , please run run the app in background and you can access any app
Hi all, I am able to navigate setting page but i want to click on Photos or general then what i have to do for ios please suggest me (settingâ>Photos â> read write).
@Vikash_Narayan can you please let me know how are you navigating to the settings page of the iphone with appium
Hi⌠Can you please share your code snippet⌠I have a requirement to switch between 2 Wi-Fi network while my other iOS app is still runningâŚ