Giter Club home page Giter Club logo

Comments (13)

Meteorix avatar Meteorix commented on May 3, 2024 1

@ElesG 谢谢你的反馈,本周版本就能支持

from airtest.

Meteorix avatar Meteorix commented on May 3, 2024

@ElesG 你看这里的motionevent够用吗:
https://github.com/AirtestProject/Airtest/blob/master/playground/android_motionevents.py

from airtest.

ElesG avatar ElesG commented on May 3, 2024

@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.

Meteorix avatar Meteorix commented on May 3, 2024

@ElesG IDE下周版本才会包含这个最新的代码

文档还没更新,先看看这里的代码吧,应该很好理解

class MotionEvent(object):

from airtest.

ElesG avatar ElesG commented on May 3, 2024

@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.

adolli avatar adolli commented on May 3, 2024

这是因为你mac上已经装了adb但是版本不匹配,可以升级adb到1.0.39或者卸载掉。

from airtest.

ElesG avatar ElesG commented on May 3, 2024

@adolli 折腾了一把终于把adb版本升级到1.0.39了,可是还是报同样的错哦?

from airtest.

adolli avatar adolli commented on May 3, 2024

试试下面的命令,看下输出是否正常

adb version
adb devices

from airtest.

Meteorix avatar Meteorix commented on May 3, 2024

@ElesG 这是因为你安装的airtest位置没有adb的执行权限

from airtest.

Meteorix avatar Meteorix commented on May 3, 2024

你可以找到airtest的安装目录,下面的adb路径,然后sudo改变权限

from airtest.

ElesG avatar ElesG commented on May 3, 2024

@Meteorix 好的 非常感谢深夜回答!我改日试试!

from airtest.

ElesG avatar ElesG commented on May 3, 2024

@Meteorix 我将airtest/core/android/adb.pyairtest/core/android/android.py都授予了运行的权限了,可是还是提示同样的错误。
我以为是因为subprocess.py也没有执行权限所以才导致报错,可是我没法给 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py授予执行权限。请问是我操作失误导致环境出现问题了吗?

###########

我原本对adb.pyandroid.py执行的是chmod +x,后来改为chmod -R 777就解决了。感谢大家的解答。

from airtest.

ElesG avatar ElesG commented on May 3, 2024

@Meteorix motionevent够用了!非常感谢!请问AirtestIDE什么时候可以支持这些操作呢?非常期待!

from airtest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.