1.登录代码如下:
//输入用户名 XCUIElement *textField = [[XCUIApplication alloc] init].textFields[@"\u8bf7\u8f93\u5165\u7231\u5b66\u6d3e\u8d26\u53f7"]; [textField tap]; [textField typeText:@"爱学派MFF"]; //输入密码 XCUIElement *element = [[[[[[[app childrenMatchingType:XCUIElementTypeWindow] elementBoundByIndex:0] childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther] elementBoundByIndex:1]; [[[element childrenMatchingType:XCUIElementTypeOther] elementBoundByIndex:0] tap]; [[[element childrenMatchingType:XCUIElementTypeOther] elementBoundByIndex:1] tap]; [app typeText:@"1111"];2.修改如下:
//输入用户名 XCUIElement *textField = [[XCUIApplication alloc] init].textFields[@"请输入爱学派账号"]; [textField tap]; [textField typeText:@"爱学派MFF"]; //输入密码 XCUIElement *element = [[[[[[[app childrenMatchingType:XCUIElementTypeWindow] elementBoundByIndex:0] childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther] elementBoundByIndex:1]; [[[element childrenMatchingType:XCUIElementTypeOther] elementBoundByIndex:0] tap]; [[[element childrenMatchingType:XCUIElementTypeOther] elementBoundByIndex:1] tap]; [app typeText:@"1111"];即@”\u8bf7\u8f93\u5165\u7231\u5b66\u6d3e\u8d26\u53f7”对应字符串“@”请输入爱学派账号””,注意中文和录制时的翻译。