Appium的使用
Appium-desktop 1.22分成了appium-desktop
与appium-inspector
appium-desktop
desktop直接点击start即可
appium-inspector
注意的是Remote Path需要填写/wd/hub
.
然后直接点击StartSession即可.(缺少什么会有报错提醒).
{
"platformName": "iOS",
"appium:bundleId": "待测试的bundleId",
"appium:automationName": "XCUITest",
"appium:deviceName": "iPhone 13 Pro Max",
"appium:udid": "设备udid"
}
如果未填写udid,点击start会开启一个Simulator.填写了真机的udid则会开启真机上对应bundleId的项目/或者报错.
Error writing xctestrun file: Error Domain=NSCocoaErrorDomain Code=4 "
The folder “WebDriverAgentRunner_iphoneos15.2-arm64.xctestrun” doesn’t exist."
UserInfo={NSFilePath=/Users/xxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-aghlrsejdreqngftgvcqwnjgrbou/Build/Products/WebDriverAgentRunner_iphoneos15.2-arm64.xctestrun, NSUserStringVariant=Folder, NSUnderlyingError=0x600002fa9020 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} ** TEST BUILD FAILED **
这是因为WebDriverAgent
太老了
git clone https://github.com/facebook/WebDriverAgent
mkdir -p Resources/WebDriverAgent.bundle
下载下来之后将Scripts路径下的bootstrap.sh文件中大概70行的`npm install`命令改为`npm i --legacy-peer-deps`.
sh ./Scripts/bootstrap.sh
-
修改BundleID
-
修改TARGETS->Build Setting->All || Combined->Validate Workspace->YES.
-
WebDriverAgent(Target)->Frameworks->iOS->RoutingHTTPServer
@property (nonatomic, assign, readonly) HTTPConnection *connection;
改为
@property (nonatomic, unsafe_unretained, readonly) HTTPConnection *connection;
PrivateHeaders/XCTest/XCTestCase.h 中添加
@property(nonatomic) BOOL shouldSetShouldHaltWhenReceivesControl; // @synthesize shouldSetShouldHaltWhenReceivesControl=_shouldSetShouldHaltWhenReceivesControl;
WebDriverAgentLib/Utilities/FBFailureProofTestCase.m 中
issues:13949
- (void)setUp
{
[super setUp];
self.continueAfterFailure = YES;
self.internalImplementation = (_XCTestCaseImplementation *)[FBXCTestCaseImplementationFailureHoldingProxy proxyWithXCTestCaseImplementation:self.internalImplementation];
}
改为
- (void)setUp
{
[super setUp];
self.continueAfterFailure = YES;
if ([self respondsToSelector:@selector(internalImplementation)]) {
self.internalImplementation = (_XCTestCaseImplementation *)[FBXCTestCaseImplementationFailureHoldingProxy proxyWithXCTestCaseImplementation:self.internalImplementation];
} else {
self.shouldSetShouldHaltWhenReceivesControl = NO;
self.shouldHaltWhenReceivesControl = NO;
}
}
command + U
国内8100端口被封禁,可以转发端口iproxy 8300 8100