Comments (13)
@ElesG 谢谢你的反馈,本周版本就能支持
from airtest.
@ElesG 你看这里的motionevent够用吗:
https://github.com/AirtestProject/Airtest/blob/master/playground/android_motionevents.py
from airtest.
@Meteorix 很感谢你的回答,看了那份sample,不是很明白DownEvent、UpEvent、MoveEvent的定义,因为他好像只有一个起始坐标却没有步长之类的参数,我怎么知道要移动多少呢?
另外我在AirTestIDE执行如下代码时他总提示我“name 'DownEvent' is not defined”,希望得到你的指引。
from airtest.core.android.minitouch import *
figure1_events = [
# 按照我的理解,我原本是想通过注释掉的这三行MoveEvent实现在手机屏幕上连续画一个“L”型
# MoveEvent((537.5,945.5),0),
# MoveEvent((537.5,1538),1),
# MoveEvent((830,1538),2)
DownEvent((100, 100), 0),
DownEvent((200, 200), 1),
SleepEvent(1),
UpEvent(0), UpEvent(1)
]
device.minitouch.perform(figure1_events)
from airtest.
@ElesG IDE下周版本才会包含这个最新的代码
文档还没更新,先看看这里的代码吧,应该很好理解
Airtest/airtest/core/android/minitouch.py
Line 456 in edf9039
from airtest.
@Meteorix 大致理解了,我决定直接运行https://github.com/AirtestProject/Airtest/blob/master/playground/android_motionevents.py试一下 验证下我的理解,可是运行过程中总提示以下报错,请问你有遇到过这种情况吗?
系统参数:
python 2.7.10 (电脑自带的)
macOS 10.13.4
已通过pip安装好了airtest
[03:24:13][DEBUG]<airtest.core.android.adb> /Library/Python/2.7/site-packages/airtest/core/android/static/adb/mac/adb devices
Traceback (most recent call last):
File "tryMove.py", line 5, in <module>
connect_device("Android:///")
File "/Library/Python/2.7/site-packages/airtest/core/api.py", line 46, in connect_device
dev = cls(uuid, **params)
File "/Library/Python/2.7/site-packages/airtest/core/android/android.py", line 29, in __init__
self.serialno = serialno or ADB().devices(state="device")[0][0]
File "/Library/Python/2.7/site-packages/airtest/core/android/adb.py", line 196, in devices
output = self.cmd("devices", device=False)
File "/Library/Python/2.7/site-packages/airtest/core/android/adb.py", line 167, in cmd
proc = self.start_cmd(cmds, device)
File "/Library/Python/2.7/site-packages/airtest/core/android/adb.py", line 146, in start_cmd
stderr=subprocess.PIPE
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
exiting.......
报错中提示到权限不足,可是我使用sudo运行同样是报这个错
from airtest.
这是因为你mac上已经装了adb但是版本不匹配,可以升级adb到1.0.39或者卸载掉。
from airtest.
@adolli 折腾了一把终于把adb版本升级到1.0.39了,可是还是报同样的错哦?
from airtest.
试试下面的命令,看下输出是否正常
adb version
adb devices
from airtest.
@ElesG 这是因为你安装的airtest位置没有adb的执行权限
from airtest.
你可以找到airtest的安装目录,下面的adb路径,然后sudo改变权限
from airtest.
@Meteorix 好的 非常感谢深夜回答!我改日试试!
from airtest.
@Meteorix 我将airtest/core/android/adb.py
、airtest/core/android/android.py
都授予了运行的权限了,可是还是提示同样的错误。
我以为是因为subprocess.py
也没有执行权限所以才导致报错,可是我没法给 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py
授予执行权限。请问是我操作失误导致环境出现问题了吗?
###########
我原本对adb.py
、android.py
执行的是chmod +x
,后来改为chmod -R 777
就解决了。感谢大家的解答。
from airtest.
@Meteorix motionevent够用了!非常感谢!请问AirtestIDE什么时候可以支持这些操作呢?非常期待!
from airtest.
Related Issues (20)
- try_log_screen与snapshot() HOT 1
- 如何获取Path from root node,以及如何通过此path定位控件。
- 开启IDE情况下,命令行执行时获取的adb进程路径有时候空的 HOT 1
- 连接鸿蒙设备
- android 设备 跑完用例时 断开设备卡住了 HOT 1
- VIVO手机截屏错误,屏幕翻转错误
- 执行完double_click()之后在报告里没有那个点击后的红圈显示
- 运行脚本启动Chrome闪退,Chrome 121.0.6167.140
- 在安卓真机上执行 keyevent( "volumeUp" ) 或 keyevent( "volumeDown" ) 无效
- airtest是否引用了psutil
- 建议移除psutil
- airtest link will automatically disconnect after working for a period of time. How to solve this problem HOT 1
- 安装完最新的appium的wda,airtest无法连接IOS HOT 1
- poco服务启动慢 HOT 2
- 如果想利用AI 配合 airtest框架实现 自动编写UI测试用例 请教下有思路吗?
- poco,text获取元素失败 HOT 2
- iOS 使用start_app报错
- airtest自动安装的urllib3库, 需要旧版 (比如1.26.17) 才能通过uid连接ios手机
- airtest ios连接的api: connect_device无法连接多台ios HOT 4
- window7 airtest 脚本编辑器窗黑屏
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from airtest.