Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Mar 31, 2021
1 parent 9515e54 commit d6071b6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/uitest_screenrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,13 @@ def write(self, data: bytes):


@contextlib.contextmanager
def make_screenrecord(c: wda.Client, output_video_path: str = "output.mp4"):
def make_screenrecord(c: wda.Client, t: tidevice.Device, output_video_path: str):
_old_fps = c.appium_settings()['mjpegServerFramerate']
_fps = 10
c.appium_settings({"mjpegServerFramerate": _fps})

# Read image from WDA mjpeg server
d = tidevice.Device()
pconn = d.create_inner_connection(9100)
pconn = t.create_inner_connection(9100) # default WDA mjpeg server port
sock = pconn.get_socket()
buf = SocketBuffer(sock)
buf.write(b"GET / HTTP/1.0\r\nHost: localhost\r\n\r\n")
Expand Down Expand Up @@ -106,8 +105,10 @@ def _drain(stop_event, done_event):


def test_main(c: wda.Client):
with make_screenrecord(c, "output.mp4"):
t = tidevice.Device()
with make_screenrecord(c, t, "output.mp4"):
app = c.session("com.apple.Preferences")
app(label="蓝牙").click()
c.sleep(1)


0 comments on commit d6071b6

Please sign in to comment.