Appium Mac 桌面安装遇到的问题解决

Xcode版本 11.4
appium 版本 1.15.1

地址 https://github.com/appium/appium-desktop/releases/tag/v1.15.1

具体安装这里就不讲了.网上有很多,大同小异,主要是mac 上安装上并不能直接使用.而已直接直接替换appium 中的webdriveragent 并不能解决问题. 照样会出现很多问题.

最终解决的 版本就是修改appium,将其中带有的webdriveragent正确就可以了. 修改 webdriveragent 遇到的问题汇总如下

问题汇总

carthage
 Error: Unable to launch WebDriverAgent because of xcodebuild failure: not found: carthage

需要安装carthage
brew install carthage

修改appium中的webdriveragent工程路径

/Applications/Appium.app/Contents/Resources/app/node_modules/appium-webdriveragent

'CocoaAsyncSocket.framework' was built for tvOS + tvOS Simulator.

error: Building for iOS Simulator, but the linked framework 'CocoaAsyncSocket.framework' was built for tvOS + tvOS Simulator. (in target 'WebDriverAgentLib' from project 'WebDriverAgent')

image.png

image.png

将tvos 中的删掉就可以了. (应该也可以修改加载这两个framework的先后顺序来解决这个问题,由于使用不到tvos ,因此我直接删除)
最终结果


image.png
XCElementSnapshot 找不到
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_XCElementSnapshot", referenced from:
l_OBJC_$_CATEGORY_XCElementSnapshot_$_FBIsVisible in XCUIElement+FBIsVisible.o
l_OBJC_$_CATEGORY_XCElementSnapshot_$_FBUID in XCUIElement+FBUID.o
l_OBJC_$_CATEGORY_XCElementSnapshot_$_WebDriverAttributes in XCUIElement+FBWebDriverAttributes.o
objc-class-ref in XCUIElement+FBWebDriverAttributes.o
objc-class-ref in XCUIElement+FBUtilities.o
l_OBJC_$_CATEGORY_XCElementSnapshot_$_FBAccessibility in XCUIElement+FBAccessibility.o
l_OBJC_$_CATEGORY_XCElementSnapshot_$_FBScrolling in XCUIElement+FBScrolling.o
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

搜索工程


我们发现工程中只有 XCElementSnapshot 的.h 文件,缺没有.m文件.

其实最早的xcode 中的XCTest.framework 中是有XCElementSnapshot类的.但是呢,后来苹果将XCElementSnapshot从XCTest.framework移动到了私有的XCTAutomationSupport.framework.
该工程中是有XCTest.framework 框架的,但是没有XCTAutomationSupport.framework. 我们需要将XCTAutomationSupport.framework.矿建添加上

方案地址

具体解决办法:

在文件WebDriverAgent.xcodeproj/project.pbxproj中增加部分代码,增加途中绿色部分,具体增加的代码查看webDriverAgent作者在git中的提交

image.png

具体添加代码如下

EE8980D321105B49001789EE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
EE8980D321105B49001789ED /* XCTAutomationSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTAutomationSupport.framework; path = Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework; sourceTree = DEVELOPER_DIR; };
EEEA70152110605600C8ADE3 /* XCTest.framework in Frameworks */,
EEEA70152110605600C8ADE2 /* XCTAutomationSupport.framework in Frameworks */,

EE8980D321105B49001789EE /* XCTest.framework */,
EE8980D321105B49001789ED /* XCTAutomationSupport.framework */,
"$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks",
"$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks",

结果截图


[UITestingUITests internalImplementation]: unrecognized selector sent to instance 0x600002ff94a0**
**2020-04-26 14:42:18.839563+0800 WebDriverAgentRunner-Runner[37632:6588820] -[UITestingUITests internalImplementation]: unrecognized selector sent to instance 0x600002ff94a0**

**t =   0.10s   Assertion Failure: :0: failed: caught "NSInvalidArgumentException", "-[UITestingUITests internalImplementation]: unrecognized selector sent to instance 0x600002ff94a0"**

**(**

    **0  CoreFoundation           0x00007fff23e3dcce __exceptionPreprocess + 350**

    **1  libobjc.A.dylib           0x00007fff50b3b9b2 objc_exception_throw + 48**

    **2  CoreFoundation           0x00007fff23e5e9f4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132**

    **3  CoreFoundation           0x00007fff23e426cc ___forwarding___ + 1436**

    **4  CoreFoundation           0x00007fff23e449b8 _CF_forwarding_prep_0 + 120**

    **5  WebDriverAgentLib          0x0000000102f0a5bb -[FBFailureProofTestCase setUp] + 107**

    **6  XCTest               0x0000000102b876f0 __48-[XCTestCase _performSetUpSequenceWithSelector:]_block_invoke_2 + 522**

    **7  XCTest               0x0000000102be0dc2 +[XCTestCase(Failures) performFailableBlock:testCase:testCaseRun:shouldInterruptTest:] + 69**

    **8  XCTest               0x0000000102be0cd4 -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 115**

    **9  XCTest               0x0000000102b874cf __48-[XCTestCase _performSetUpSequenceWithSelector:]_block_invoke + 110**

    **10 XCTest               0x0000000102bf32a7 -[XCTContext _runActivityNamed:type:block:] + 245**

    **11 XCTest               0x0000000102b90c71 -[XCTestCase startActivityWithTitle:type:block:] + 186**

    **12 XCTest               0x0000000102b90e39 -[XCTestCase startActivityWithTitle:block:] + 60**

    **13 XCTest               0x0000000102b87458 -[XCTestCase _performSetUpSequenceWithSelector:] + 100**

    **14 XCTest               0x0000000102b85838 -[XCTestCase invokeTest] + 737**

    **15 XCTest               0x0000000102b87329 __26-[XCTestCase performTest:]_block_invoke_2 + 43**

    **16 XCTest               0x0000000102be0dc2 +[XCTestCase(Failures) performFailableBlock:testCase:testCaseRun:shouldInterruptTest:] + 69**

    **17 XCTest               0x0000000102be0cd4 -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 115**

    **18 XCTest               0x0000000102b87260 __26-[XCTestCase performTest:]_block_invoke.359 + 86**

    **19 XCTest               0x0000000102bf3a0d +[XCTContext runInContextForTestCase:block:] + 211**

    **20 XCTest               0x0000000102b86b14 -[XCTestCase performTest:] + 566**

    **21 XCTest               0x0000000102bcd38e -[XCTest runTest] + 57**

    **22 XCTest               0x0000000102b80d50 __27-[XCTestSuite performTest:]_block_invoke + 354**

    **23 XCTest               0x0000000102b804a2 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 24**

    **24 XCTest               0x0000000102bf3a0d +[XCTContext runInContextForTestCase:block:] + 211**

    **25 XCTest               0x0000000102b80459 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 148**

    **26 XCTest               0x0000000102b807be -[XCTestSuite performTest:] + 348**

    **27 XCTest               0x0000000102bcd38e -[XCTest runTest] + 57**

    **28 XCTest               0x0000000102b80d50 __27-[XCTestSuite performTest:]_block_invoke + 354**

    **29 XCTest               0x0000000102b804a2 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 24**

    **30 XCTest               0x0000000102bf3a0d +[XCTContext runInContextForTestCase:block:] + 211**

    **31 XCTest               0x0000000102b80459 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 148**

    **32 XCTest               0x0000000102b807be -[XCTestSuite performTest:] + 348**

    **33 XCTest               0x0000000102bcd38e -[XCTest runTest] + 57**

    **34 XCTest               0x0000000102b80d50 __27-[XCTestSuite performTest:]_block_invoke + 354**

    **35 XCTest               0x0000000102b804a2 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 24**

    **36 XCTest               0x0000000102bf3a0d +[XCTContext runInContextForTestCase:block:] + 211**

    **37 XCTest               0x0000000102b80459 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 148**

    **38 XCTest               0x0000000102b807be -[XCTestSuite performTest:] + 348**

    **39 XCTest               0x0000000102bcd38e -[XCTest runTest] + 57**

    **40 XCTest               0x0000000102c02f14 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 171**

    **41 XCTest               0x0000000102c03001 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke.100 + 96**

    **42 XCTest               0x0000000102b9b746 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 682**

    **43 XCTest               0x0000000102c02c9f -[XCTTestRunSession runTestsAndReturnError:] + 615**

    **44 XCTest               0x0000000102b64744 -[XCTestDriver runTestsAndReturnError:] + 456**

    **45 XCTest               0x0000000102bef64c _XCTestMain + 2496**

    **46 WebDriverAgentRunner-Runner     0x0000000102971e1a -[_XCTRunnerAppDelegate applicationWillResignActive:] + 0**

    **47 WebDriverAgentRunner-Runner     0x0000000102971d18 _XCTRunnerRunTests + 0**

    **48 CoreFoundation           0x00007fff23da1a9c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12**

    **49 CoreFoundation           0x00007fff23da1193 __CFRunLoopDoBlocks + 195**

    **50 CoreFoundation           0x00007fff23d9bf83 __CFRunLoopRun + 995**

    **51 CoreFoundation           0x00007fff23d9b884 CFRunLoopRunSpecific + 404**

    **52 GraphicsServices          0x00007fff38b5ac1a GSEventRunModal + 139**

    **53 UIKitCore              0x00007fff48c19220 UIApplicationMain + 1605**

    **54 WebDriverAgentRunner-Runner     0x0000000102971fd5 main + 183**

    **55 libdyld.dylib            0x00007fff519b910d start + 1**

    **56 ???                 0x0000000000000005 0x0 + 5**

**)**

**t =   0.11s Tear Down**

**Test Case '-[UITestingUITests testRunner]' failed (0.116 seconds).**

**Test Suite 'UITestingUITests' failed at 2020-04-26 14:42:18.952.**

     **Executed 1 test, with 1 failure (1 unexpected) in 0.116 (0.201) seconds**

**Test Suite 'WebDriverAgentRunner.xctest' failed at 2020-04-26 14:42:18.953.**

     **Executed 1 test, with 1 failure (1 unexpected) in 0.116 (0.202) seconds**

**Test Suite 'All tests' failed at 2020-04-26 14:42:18.954.**

     **Executed 1 test, with 1 failure (1 unexpected) in 0.116 (0.205) seconds**

解决办法是


将XCTestCase中的选中部分移动到


image.png

即可

解决结果,成功启动服务器


image.png

'+[XCTestDriver sharedTestDriver]: unrecognized selector sent to class 0x108a64e68' 错误解决办法

+ (id)retrieveTestRunnerProxy
{
  if ([[XCTestDriver sharedTestDriver] respondsToSelector:@selector(managerProxy)]) {
    return [XCTestDriver sharedTestDriver].managerProxy;
  } else {
    return ((XCTRunnerDaemonSession *)[FBXCTRunnerDaemonSessionClass sharedSession]).daemonProxy;
  }
}

找到以上代码,修改成

+ (id)retrieveTestRunnerProxy
{
//  if ([[XCTestDriver sharedTestDriver] respondsToSelector:@selector(managerProxy)]) {
//    return [XCTestDriver sharedTestDriver].managerProxy;
//  } else {
    return ((XCTRunnerDaemonSession *)[FBXCTRunnerDaemonSessionClass sharedSession]).daemonProxy;
//  }
}

你可能感兴趣的:(Appium Mac 桌面安装遇到的问题解决)