如何做自己的网站后台,python语言基础知识,WordPress站群模版,网站备案号是什么1.目标
由于看直播的时候主播叫我发 666#xff0c;支持他#xff0c;我肯定支持他呀#xff0c;就一直发#xff0c;可是后来发现太浪费时间了#xff0c;能不能做一个直播间自动发 666 呢#xff1f;于是就开始下面的操作。
2.操作环境 iPhone一台 WebDriverAgent …1.目标
由于看直播的时候主播叫我发 666支持他我肯定支持他呀就一直发可是后来发现太浪费时间了能不能做一个直播间自动发 666 呢于是就开始下面的操作。
2.操作环境 iPhone一台 WebDriverAgent mac 安装 Xcode 3.流程
首先安装WebDriverAgent 安装教程请看上一篇
web-driver-agent_appium-实现自动点击滑动屏幕https://ccccc.blog.csdn.net/article/details/134053551 界面输入文本 api
[[FBRoute POST:/wda/keys] respondWithTarget:self action:selector(handleKeys:)], (idFBResponsePayload)handleKeys:(FBRouteRequest *)request
{NSString *textToType [request.arguments[value] componentsJoinedByString:];NSUInteger frequency [request.arguments[frequency] unsignedIntegerValue] ?: [FBConfiguration maxTypingFrequency];NSError *error;if (![FBKeyboard typeText:textToType frequency:frequency error:error]) {return FBResponseWithStatus([FBCommandStatus invalidElementStateErrorWithMessage:error.descriptiontraceback:nil]);}return FBResponseWithOK();
} 实现源码 (BOOL)typeText:(NSString *)text error:(NSError **)error
{return [self typeText:text frequency:[FBConfiguration maxTypingFrequency] error:error];
} (BOOL)typeText:(NSString *)text frequency:(NSUInteger)frequency error:(NSError **)error
{__block BOOL didSucceed NO;__block NSError *innerError;[FBRunLoopSpinner spinUntilCompletion:^(void(^completion)(void)){[[FBXCTestDaemonsProxy testRunnerProxy]_XCT_sendString:textmaximumFrequency:frequencycompletion:^(NSError *typingError){didSucceed (typingError nil);innerError typingError;completion();}];}];if (error) {*error innerError;}return didSucceed;
} 方法已经找到开始调用他
自己写一个 app安装到手机 获取手机屏幕信息
(void)window_size{NSLog(开始window_size %,-------------------);NSString* url ;url [NSString stringWithFormat:http://127.0.0.1:8100/session/%/window/size,iPhoneSessionId];[xddHttp reqWithMethodxdd2:url Method:0 HTTPBody: Block:^(NSURLResponse * response, NSDictionary * data) {NSLog(window_size结果 %,data);
// [0] (null) width : (long)414
// [1] (null) height : (long)736iPhoneWidth [data[value][width] longLongValue];iPhoneHeight [data[value][height] longLongValue];}];} 调用输入
(void)element_value:(NSString*)text
{NSLog(开始输入 %,-------------------);NSString* url ;url [NSString stringWithFormat:http://127.0.0.1:8100/session/%/element/38CB6A3B02B28FAFB0754B03D12AA7646ACEA558/value2,iPhoneSessionId];//1// url [NSString stringWithFormat:http://127.0.0.1:8100/session/%/wda/keys,iPhoneSessionId];//2NSString*body ;body {\text\:\123好hao\};//1body {\value\:[\123好hao\\r\\n\],\frequency\:10};//2body [NSString stringWithFormat:{\text\:\%\},text];[xddHttp reqWithMethodxdd2:url Method:1 HTTPBody:body Block:^(NSURLResponse * _Nonnull response, NSDictionary * _Nonnull data) {NSLog(输入结果 %,data);}];
}(void)element_value{[self element_value:123好hao];
} 开启定时器实现自动发送
(void)myTimers{userarr [self testArr];dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{// 在这里执行你的任务//[self goo:nil];});myTimer [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:selector(goo:) userInfo:nil repeats:YES];} 点击屏幕的输入框然后输入文字
(void)goo:(NSTimer *)timer{NSString*msgText [xddCode getinfo:sendText];NSString*msgTextKu userarr[sendCount];NSString*text [NSString stringWithFormat:%%\\r,msgText,msgTextKu];myAlertController.message[NSString stringWithFormat: [%d / %lu] %_%,(sendCount1),(unsigned long)userarr.count,msgText,msgTextKu];sendCount sendCount 1;NSString*url [NSString stringWithFormat:http://127.0.0.1:8100/session/%/wda/touch/perform,iPhoneSessionId];NSString*body ;body {\actions\:[{\action\:\tap\,\options\:{\x\:131,\y\:248}}]};//点击body {\actions\:[{\action\:\tap\,\options\:{\x\:131,\y\:248}}]};//点击body [NSString stringWithFormat:{\actions\:[{\action\:\tap\,\options\:{\x\:50,\y\:%ld}}]},iPhoneHeight-50];[xddHttp reqWithMethodxdd2:url Method:1 HTTPBody:body Block:^(NSURLResponse * response, NSDictionary * data) {NSLog(点击结果 %,data);NSString*msgTextKu userarr[sendCount];NSString*text [NSString stringWithFormat:%%%\\r,msgText,msgTextKu,[xddCode getTime:ss]];[self element_value:text];//输入文字}];}
实现效果
https://live.csdn.net/v/340697https://live.csdn.net/v/340697 web-driver-agent_appium自动输入