Closed lxmn1 closed 6 months ago
Also, I am new to Mac2 driver. Can I check if the steps I run my script now is correct?
automationmodetool enable-automationmode-without-authentication
appium server
which starts appium on http://127.0.0.1:4723/ python3 script.py
for above scriptUpdate: I was indeed able to get it to work by creating the build folder in /Users/usr/.appium/node_modules/appium-mac2-driver/WebDriverAgentMac manually
Did you install appium with sudo etc? I wondered if your node env affected the configuration. For example if you managed node with nvm
with user permission only, the permission issue won't happen.
I adapted this Python script from README,
However, I receive errors logged to console related to permissions denied:
[WebDriverAgentMac] Using bootstrap root: /Users/usr/.appium/node_modules/appium-mac2-driver/WebDriverAgentMac [WebDriverAgentMac] Using xcodebuild binary at '/usr/bin/xcodebuild' [WebDriverAgentMac] There is no need to perform the project cleanup. A fresh install has been detected [WebDriverAgentMac] Using 127.0.0.1 as server host [WebDriverAgentMac] Using port 10100 [WebDriverAgentMac] Starting Mac2Driver host process: xcodebuild build-for-testing test-without-building -project /Users/usr/.appium/node_modules/appium-mac2-driver/WebDriverAgentMac/WebDriverAgentMac.xcodeproj -scheme WebDriverAgentRunner COMPILER_INDEX_STORE_ENABLE\=NO [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:10100/status] with no body [WD Proxy] connect ECONNREFUSED 127.0.0.1:10100 [WebDriverAgentMac] [xcodebuild] 2023-12-12 17:09:57.446 xcodebuild[73363:2813098] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) [WebDriverAgentMac] [xcodebuild] Command line invocation: [WebDriverAgentMac] [xcodebuild] /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild build-for-testing test-without-building -project /Users/usr/.appium/node_modules/appium-mac2-driver/WebDriverAgentMac/WebDriverAgentMac.xcodeproj -scheme WebDriverAgentRunner COMPILER_INDEX_STORE_ENABLE=NO [WebDriverAgentMac] [WebDriverAgentMac] User defaults from command line: [WebDriverAgentMac] IDEPackageSupportUseBuiltinSCM = YES [WebDriverAgentMac] [WebDriverAgentMac] Build settings from command line: [WebDriverAgentMac] COMPILER_INDEX_STORE_ENABLE = NO [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:10100/status] with no body [WD Proxy] connect ECONNREFUSED 127.0.0.1:10100 [WebDriverAgentMac] [xcodebuild] --- xcodebuild: WARNING: Using the first of multiple matching destinations: [WebDriverAgentMac] { platform:macOS, arch:arm64, id:00006020-000A711E2E33C01E } [WebDriverAgentMac] { platform:macOS, arch:x86_64, id:00006020-000A711E2E33C01E } [WebDriverAgentMac] { platform:macOS, name:Any Mac } [WebDriverAgentMac] [xcodebuild] Computing target dependency graph and provisioning inputs [WebDriverAgentMac] [xcodebuild] Create build description [WebDriverAgentMac] [xcodebuild] Command failed with a nonzero exit code [WebDriverAgentMac] [xcodebuild] error: unexpected service error: build aborted due to an internal error: unable to write manifest to '/Users/usr/.appium/node_modules/appium-mac2-driver/WebDriverAgentMac/build/XCBuildData/8719c7c722ada64ef9014fff22e63f69.xcbuilddata/manifest.json': mkdir(/Users/usr/.appium/node_modules/appium-mac2-driver/WebDriverAgentMac/build, S_IRWXU | S_IRWXG | S_IRWXO): Permission denied (13) [WebDriverAgentMac] [xcodebuild] 2023-12-12 17:09:57.938 xcodebuild[73363:2813098] Writing error result bundle to /var/folders/h4/j8kvjrl93mxc27n5bw4_lv040000gp/T/ResultBundle_2023-12-12_17-09-0057.xcresult [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:10100/status] with no body [WD Proxy] connect ECONNREFUSED 127.0.0.1:10100 [WebDriverAgentMac] [xcodebuild] xcodebuild: error: Failed writing xctestrun file: The folder “WebDriverAgentRunner_macosx13.3-arm64.xctestrun” doesn’t exist.. [WebDriverAgentMac] Mac2Driver host process has exited with code 70, signal null [WebDriverAgentMac] Mac2Driver session cannot be stopped, because the server is not running [AppiumDriver@4c4a] Event 'newSessionStarted' logged at 1702372199565 (17:09:59 GMT+0800 (Singapore Standard Time)) [AppiumDriver@4c4a] Encountered internal error running command: Error: An unknown server-side error occurred while processing the command. Original error: 'GET /status' cannot be proxied to Mac2 Driver server because its process is not running (probably crashed). Check the Appium log for more details
When I run this command
xcodebuild build-for-testing test-without-building -project ~/.appium/node_modules/appium-mac2-driver/WebDriverAgentMac/WebDriverAgentMac.xcodeproj -scheme WebDriverAgentRunner COMPILER_INDEX_STORE_ENABLE=NO
in my Mac terminal, I receive an errorerror: unexpected service error: build aborted due to an internal error: unable to write manifest to '/Users/usr/.appium/node_modules/appium-mac2-driver/WebDriverAgentMac/build/XCBuildData/0a67e4a1bd729f617eec2c127c38bb56.xcbuilddata/manifest.json': mkdir(/Users/usr/.appium/node_modules/appium-mac2-driver/WebDriverAgentMac/build, S_IRWXU | S_IRWXG | S_IRWXO): Permission denied (13)
, but it does run successfully with sudo.Hence, I am guessing the error from the Python script is related to insufficient permissions when passing in Mac2Options, is it possible to add to Mac2Options an option to run in sudo mode?