Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS已完美运行 #99

Closed
SiliconZou opened this issue Dec 30, 2017 · 201 comments
Closed

iOS已完美运行 #99

SiliconZou opened this issue Dec 30, 2017 · 201 comments
Labels

Comments

@SiliconZou
Copy link

img_2017
多谢楼主分享,技术无止境

@MartinWong-H
Copy link

raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1053cf0f0>: Failed to establish a new connection: [Errno 61] Connection refused',))
这个有遇到过吗

@overthehump
Copy link

大神 求一个 IOS 的简单教程 需要什么东西。 我是WIN 10系统。。。 需要什么软件 运行什么脚本呢? 感谢

@SiliconZou
Copy link
Author

@xiao-Warning
配置WDA的最后:有些国产的iPhone机器通过手机的IP和端口还不能访问,此时需要将手机的端口转发到Mac上。

$ brew install libimobiledevice
$ iproxy 8100 8100
这时如果访问 http://localhost:8100/status 能显示一堆JSON数据,就说明WDA运行成功
然后再试试,应该就可以了

@MartinWong-H
Copy link

👌 谢谢 我试试看

@SiliconZou
Copy link
Author

@overthehump iOS我也是按照楼主的步骤一步一步来的,我用的MacBook Pro,win10的话可以装Mac的虚拟机,不过比较麻烦

@SIXSIXSIXX
Copy link

大神 我运行的时候 截的图有时候不太对 你有这种情况吗

@GhostClock
Copy link

@SiliconZou @xiao-Warning
我也遇到这个错误了,在浏览器里面访问 http://localhost:8100/status 能显示一堆JSON数据,但是就是报异常
2017-12-30 18 15 54

@SiliconZou
Copy link
Author

@SIXSIXSIXX 我这边截图的时候会把Python的进程给杀掉,但是还可以再重新运行,没发现图不对

@MartinWong-H
Copy link

@GhostClock Traceback (most recent call last):
File "wechat_jump_iOS_py3.py", line 30, in
pull_screenshot()
File "wechat_jump_iOS_py3.py", line 19, in pull_screenshot
c.screenshot('1.png')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wda/init.py", line 295, in screenshot
value = self.http.get('screenshot').value
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wda/init.py", line 101, in fetch
return self._fetch_no_alert(method, url, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wda/init.py", line 107, in _fetch_no_alert
return httpdo(target_url, method, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wda/init.py", line 83, in httpdo
raise WDAError(r.status, r.value)
wda.WDAError: WDAError(status=13, value=To screenshot a frame, it must have non-0 area.

(
0 CoreFoundation 0x00000001824c2dc8 + 148
1 libobjc.A.dylib 0x0000000181b27f80 objc_exception_throw + 56
2 CoreFoundation 0x00000001824c2c80 + 0
3 Foundation 0x0000000182e48154 + 112
4 XCTest 0x000000010008806c -[XCUIScreen _screenshotDataForQuality:rect:error:] + 192
5 XCTest 0x0000000100087f38 -[XCUIScreen screenshotDataForQuality:rect:error:] + 108
6 WebDriverAgentLib 0x0000000106b3f2dc -[XCUIDevice(FBHelpers) fb_screenshotWithError:] + 624
7 WebDriverAgentLib 0x0000000106b20dbc +[FBScreenshotCommands handleGetScreenshot:] + 132
8 WebDriverAgentLib 0x0000000106b2da10 -[FBRoute_TargetAction mountRequest:intoResponse:] + 208
9 WebDriverAgentLib 0x0000000106b2563c __37-[FBWebServer registerRouteHandlers:]_block_invoke + 496
10 RoutingHTTPServer 0x0000000106bde3cc -[RoutingHTTPServer handleRoute:withRequest:response:] + 144
11 RoutingHTTPServer 0x0000000106bdeb80 __72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 44
12 libdispatch.dylib 0x0000000181f0d47c + 16
13 libdispatch.dylib 0x0000000181f1cae8 + 644
14 libdispatch.dylib 0x0000000181f0d47c + 16
15 libdispatch.dylib 0x0000000181f12b84 _dispatch_main_queue_callback_4CF + 1844
16 CoreFoundation 0x0000000182478d50 + 12
17 CoreFoundation 0x0000000182476bb8 + 1628
18 CoreFoundation 0x00000001823a0c50 CFRunLoopRunSpecific + 384
19 Foundation 0x0000000182db0cfc + 308
20 WebDriverAgentLib 0x0000000106b24630 -[FBWebServer startServing] + 424
21 WebDriverAgentRunner 0x00000001006abbe4 -[UITestingUITests testRunner] + 132
22 CoreFoundation 0x00000001824c8a60 + 144
23 CoreFoundation 0x00000001823c0488 + 284
24 XCTest 0x0000000100072654 __24-[XCTestCase invokeTest]_block_invoke.275 + 48
25 XCTest 0x0000000100072404 __24-[XCTestCase invokeTest]_block_invoke + 680
26 XCTest 0x00000001000b89d8 -[XCUITestContext performInScope:] + 208
27 XCTest 0x000000010007214c -[XCTestCase invokeTest] + 136
28 XCTest 0x0000000100073224 __26-[XCTestCase performTest:]_block_invoke.382 + 48
29 XCTest 0x00000001000bda78 +[XCTContext runInContextForTestCase:block:] + 164
30 XCTest 0x0000000100072c20 -[XCTestCase performTest:] + 596
31 XCTest 0x000000010006ee14 __27-[XCTestSuite performTest:]_block_invoke + 288
32 XCTest 0x000000010006e83c -[XCTestSuite _performProtectedSectionForTest:testSection:] + 44
我访问localhost之后一执行python3 wechat_jump_iOS_py3.py就这样了

@SiliconZou
Copy link
Author

@xiao-Warning 我访问localhost是错误没数据的,然后iproxy 8100 8100后 再打开http://localhost:8100/inspector就可以了

@MartinWong-H
Copy link

image
我这个打开是这样子,不过执行python3 wechat_jump_iOS_py3.py 还是跪了

@badkk
Copy link

badkk commented Dec 30, 2017

楼主,IOS可以自动跳吗?

@sigai
Copy link

sigai commented Dec 30, 2017

iphone 6s

time_coefficient = 0.00190
不会用GitHub发这里了

@ghost
Copy link

ghost commented Dec 30, 2017

卡在iproxy这一项了,
$iproxy 8100 8100
waiting for connection
accepted connection, fd = 4
waiting for connection
Number of available devices == 1
Requesting connecion to device handle == 40 (serial: 81d9164fb0991126168fc7b35d493205ae067ffb), port 8100
Error connecting to device!
启动之后
$ python3 wechat_jump_iOS_py3.py
retry to connect, error: HTTPConnectionPool(host='localhost', port=8100): Read timed out. (read timeout=60.0)
提示错误

@SiliconZou
Copy link
Author

@LucasDvP 好像是不能,我是一步一步点着跳的😂 iPhone6的参数time_coefficient = 0.00200

@SiliconZou
Copy link
Author

@w0wbin 我刚开始也是一直waiting for connection,然后就打开http://localhost:8100/inspector这个网址,同时也要打开小游戏的界面,多刷新了几次等手机界面上的内容显示到网址后再次运行 wechat_jump_iOS_py3.py就可以了

@hopesala
Copy link

pip install -t /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages --pre facebook-wda

image

@ghost
Copy link

ghost commented Dec 30, 2017

到iproxy 8100 8100 打开浏览器这一步得到的是这个
2017-12-31 12 47 51

@sxxhlx
Copy link

sxxhlx commented Dec 30, 2017

iPhone 7 Plus 系数
time_coefficient = 0.00120

@siitao
Copy link

siitao commented Dec 30, 2017

我运行出来的图怎么是这个
image

@ghost
Copy link

ghost commented Dec 30, 2017

@siitao 你这个应该是直接运行py文件之后的结果吧。其他都还没弄吧。

@siitao
Copy link

siitao commented Dec 30, 2017

@w0wbin 起来的弄了 localhost:8100的图也是这样的 是我哪一步没做对 还是漏了
image

@cultivater
Copy link

@xiao-Warning 我遇到的问题和你一模一样 请问你解决了吗

@cultivater
Copy link

@siitao 你这个是模拟器,不是手机的界面

@froyoe
Copy link

froyoe commented Dec 30, 2017

@SiliconZou requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)) 这是是什么情况

@Qiuliuyang
Copy link

成功实现了。不过不能自动跳,哪个大神尽快出自动跳版本吧

@charlesYun
Copy link

我也可以实现了,但是需要手动点击一下,每次不能跳到中心点,有误差,有时候也会跳不上去。这个应该怎么处理啊

@D4rkCrypto
Copy link

Android的auto脚本稍稍改下就可以在ios上自动跳了,不过参数一直不够完美,只能跳到几百,就不发出来了,等dalao撸个完美的。

@zhangmyWZDY
Copy link

@SwiftieTerrence 求IOS自动跳的脚本

@Qiuliuyang
Copy link

1

我的运行除了不能自动跳都ok。跳不准的只能自己掌握以下技巧了吧

@QI-charles
Copy link

@2649073896 pip默认安装2.7里面 如果你py2和3都安装了 pip3安装在3下面

@2882889
Copy link

2882889 commented Jan 3, 2018

@xiao-Warning
代码里面加微信的boundID
s = c.session('com.tencent.xin')

def pull_screenshot():
time.sleep(10)
c.screenshot('1.png')
截图前休眠10秒

然后启动脚本手动点进游戏

@surpassing
Copy link

@taylorwrynn 我搞定了感谢! 还是conda环境切错了,系统默认的不是我用pip install的那个,最后conda env list看了下,source activate另一个就好了。 感谢:)

@paveldbest
Copy link

请问依赖文件到底是装在哪里?
也就是说 这个 pip3 install -r requirements.txt 应该在哪里执行?

@xiaoxm
Copy link

xiaoxm commented Jan 4, 2018

@paveldbest 得把这个项目下载下来,然后cd进去执行

@mkblbj
Copy link

mkblbj commented Jan 4, 2018

很好奇你们怎么那么高分的,我无论怎么调整都不超过800分

@ImmerTry
Copy link

ImmerTry commented Jan 4, 2018

(wechat_env) SugarMan:wechat_jump_game-master SugarMan$ python3 wechat_jump_auto_iOS.py
Traceback (most recent call last):
File "wechat_jump_auto_iOS.py", line 31, in
config = json.load(f)
File "/Users/Super/anaconda3/envs/wechat_env/lib/python3.6/json/init.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/Users/Super/anaconda3/envs/wechat_env/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/Users/Super/anaconda3/envs/wechat_env/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/Super/anaconda3/envs/wechat_env/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 7 column 1 (char 6)

我这个在http://127.0.0.1:8100/inspector可以点击 但是运行不了脚本

@zfx5130
Copy link

zfx5130 commented Jan 4, 2018

好不容易可以自动跳了,结果试了n多次 最多不超过50。。。。。。

@addingzb
Copy link

addingzb commented Jan 5, 2018

2018-01-05 10:56:49.202543 WebDriverAgentRunner-Runner[1569:496858] Enqueue Failure: Application local.pid.1446 is not running /Users/dingzb/Documents/XcodeSpace/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1
2018-01-05 10:56:49.205447 WebDriverAgentRunner-Runner[1569:496858] *** Assertion failure in -[XCUIScreen _screenshotDataForQuality:rect:error:], /Library/Caches/com.apple.xbs/Sources/XCTest_iOS/XCTest-13764/Sources/UITesting/XCUIScreen.m:230

@addingzb
Copy link

addingzb commented Jan 5, 2018

2018-01-05 10:56:49.202543 WebDriverAgentRunner-Runner[1569:496858] Enqueue Failure: Application local.pid.1446 is not running /Users/dingzb/Documents/XcodeSpace/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1
2018-01-05 10:56:49.205447 WebDriverAgentRunner-Runner[1569:496858] *** Assertion failure in -[XCUIScreen _screenshotDataForQuality:rect:error:], /Library/Caches/com.apple.xbs/Sources/XCTest_iOS/XCTest-13764/Sources/UITesting/XCUIScreen.m:230

导致python 截屏失败了。。。。。。怎么回事。

@ZxLeo
Copy link

ZxLeo commented Jan 5, 2018

@xiao-Warning python3 wechat_jump_iOS_py3.py python3 wechat_jump_auto_iOS.py Python工程里这俩改下代码,c = wda.Client('http://127.0.0.1:8200') 换个端口。 IOS工程里找到8100 也相应的改下端口。

@F-loat F-loat added the iOS label Jan 5, 2018
@pengyou200902
Copy link

pengyou200902 commented Jan 5, 2018

windows+ios,请问怎么办。。。借了别人安卓跑成功了,现在自己iphone6sp不知所措

@AlexisWu-01
Copy link

我都成功了。。但是连30都跳不过。。233333

@bojunwu
Copy link

bojunwu commented Jan 6, 2018

我前面一切正常。截图什么都有 最后运行PYTHON的时候 出现 requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1076ca198>: Failed to establish a new connection: [Errno 61] Connection refused',)) 怎么破?

@bojunwu
Copy link

bojunwu commented Jan 6, 2018

@hesj 我和你同样的问题,是python里面没法用localhost连接到127.0.0.1导致的,我还不知道为什么,不过我把代码里面的

  • c = wda.Client()

成功的解决了我的问题

@dandan0503
Copy link

@SiliconZou 我无论怎么刷新,都还是连接不上

@stayRealLang
Copy link

iproxy命令运行不了是怎么回事啊 有没有人出现过
$ brew install libimobiledevice
Warning: libimobiledevice 1.2.0_2 is already installed
$ iproxy 8100 8100
-bash: iproxy: command not found

@YAANNZ
Copy link

YAANNZ commented Jan 8, 2018

@stayRealLang $ brew install usbmuxd 加上这个

@stayRealLang
Copy link

@YAANNZ 可以了!多谢大佬

@brilliantGuo
Copy link

大佬你好,我是 iOS + Mac 的,在安装 WDA 的时候按照 https://testerhome.com/topics/7220 这个帖子来配置,运行初始化脚本和配置证书都能成功,结果编译的时候出错了,好像是缺少 XCUIScreen 这个文件?想请问下这个情况应该如何解决?

Mac 系统:10.12.5
Xcode 版本:8.3.3
iOS 版本:10.3.2(build time 的时候报错了,所以我觉得应该不是手机版本的问题)

错误代码:

~/WebDriverAgent/PrivateHeaders/XCTest/XCUIScreen.h:7:12: Cannot find interface declaration for 'XCUIScreen'; did you mean 'UIScreen'?
~/WebDriverAgent/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m:147:3: Unknown type name 'XCUIScreen'; did you mean 'UIScreen'?
~/WebDriverAgent/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m:147:29: Use of undeclared identifier 'XCUIScreen'
~/WebDriverAgent/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m:147:43: Missing '[' at start of message send expression
~/WebDriverAgent-master/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m:67:3: Unknown type name 'XCUIScreen'; did you mean 'UIScreen'?
~/WebDriverAgent-master/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m:67:29: Use of undeclared identifier 'XCUIScreen'
~/WebDriverAgent-master/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m:67:43: Missing '[' at start of message send expression
~/WebDriverAgent-master/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m:147:41: Expected expression
~/WebDriverAgent-master/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m:147:68: Expected ']'
~/WebDriverAgent-master/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m:67:41: Expected expression
~/WebDriverAgent-master/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m:67:68: Expected ']'

错误代码1
错误代码2
错误代码3

我没有对代码做任何修改,clone 下来配置完 build 就直接报错了。因为不是做 iOS 开发的,我对代码一点不熟,希望大佬能够帮忙纠正一下错误,谢谢!

@roMummy
Copy link

roMummy commented Jan 9, 2018

raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1053cf0f0>: Failed to establish a new connection: [Errno 61] Connection refused',))

出现这个问题是因为连接的是localhost这个地址,你可以直接更改脚本,把地址设置成wda获取的地址,例如这样

c = wda.Client("http://169.xxx.xxx.205:8100")

@roMummy
Copy link

roMummy commented Jan 9, 2018

@xiao-Warning

@HelloZS
Copy link

HelloZS commented Jan 11, 2018

http://...:8100/inspector 截图和其他的都是空白是什么原因,

http://...:8100/status 这个地址里面的json数据正常

@zeliu
Copy link

zeliu commented Jan 11, 2018

@HelloZS 我和你的情况一样,不知道怎么解决 - _ -

@HelloZS
Copy link

HelloZS commented Jan 11, 2018

@zeliu 这个问题不影响玩跳一跳

@alsosweet
Copy link

@shoufu 网上说更新到Xcode9+ 你试试,我和你一样的问题。现在又在更新os中。。。

@memorylikun
Copy link

搞定了,感谢分享。

@binzi56
Copy link

binzi56 commented Oct 10, 2020

image
我这个打开是这样子,不过执行python3 wechat_jump_iOS_py3.py 还是跪了
解决了吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests