Giter Club home page Giter Club logo

dreammultidevices's People

Contributors

saint228 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dreammultidevices's Issues

ScreenOFF.py 未将adb.exe目录加入环境变量前提下会提示找不到 adb

操作步骤

  1. 配置 config.ini
[config]
packname =com.ifeng.fhdt
#packname =com.toutiao.kaililong.xjsj
activityname =
deviceslist =
apkpath =F:\helloc\pipenv_proj\warpy_airtestpoco\PIPENV_EENV_IN_PROJECT\warpy_airtestpoco-OqiTcr_4\Lib\site-packages\DreamMultiDevices\ifengfm_v7.3.3_20190401.apk

其他参数保持不变


2. 执行 start.py 程序
F:\helloc\pipenv_proj\warpy_airtestpoco>PIPENV_EENV_IN_PROJECT\warpy_airtestpoco-OqiTcr_4\Scripts\pipenv.exe run python PIPENV_EENV_IN_PROJECT\warpy_airtestpoco-OqiTcr_4\Lib\site-packages\DreamMultiDevices\start.py

3. 收到反馈(问题现象)
2020-07-11 22:21:31 测试结束
adb -s ec3c14da  shell dumpsys window policy|findstr mScreenOnFully
'adb' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
'adb' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
'adb' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
ec3c14da has been ScreenOFF

问题分析

通过搜索错误信息,找到代码位置 ScreenOFF.py

import sys,os,time

def setScreenOFF(device):
    platform = sys.platform
    command1 = command2 = ""
    # setScreenON(device)
    if platform == "win32":
        command1 = "adb -s {}  shell dumpsys window policy|findstr mScreenOnFully".format(device)
    else:
        command1 = "adb -s {}  shell dumpsys window policy|grep mScreenOnFully".format(device)
    print(command1)

...

修改建议

因为 DreamMultiDevice 库依赖于 airtest,建议直接取 airtest 自带的 adb
修改文件 ScreenOFF.py

from airtest.core.android.adb import ADB
adb = ADB().adb_path

    if platform == "win32":
        command1 = adb + " -s {}  shell dumpsys window policy|findstr mScreenOnFully".format(device)
    else:
        command1 = adb + " -s {}  shell dumpsys window policy|grep mScreenOnFully".format(device)

...

        command2 = adb + " -s {}  shell input keyevent 26".format(device)

...

验证结果

验证OK,如下图所示
image

pip install 报错了

Collecting DreamMultiDevices
Using cached https://files.pythonhosted.org/packages/d6/65/9e68e933825dba8f0fdaf9284e0ef3f3506c8dff4cff3e0cfdd30dd12084/DreamMultiDevices-1.11.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "c:\users\admini~1\appdata\local\temp\pip-install-ornoym\DreamMultiDevices\setup.py", line 8, in
with open("README.md", "r",encoding='utf-8') as fh:
TypeError: 'encoding' is an invalid keyword argument for this function

麻烦看下这个encoding 字段 出了啥问题了吗?

模拟器用图片识别报错

from airtest.core.api import *
connect_device('Android://127.0.0.1:5037/127.0.0.1:62001')
if exists(Template(r"..\img\tpl1566374671903.png", record_pos=(0.077, -0.149), resolution=(2340, 1080))):
print('sdf')
报错如下:
Traceback (most recent call last):
File "F:/lyydezdh/GFtest/sss.py", line 8, in
if exists(Template(r"..\img\tpl1566374671903.png", record_pos=(0.077, -0.149), resolution=(2340, 1080))):
File "D:\Python\Python37\lib\site-packages\airtest\utils\logwraper.py", line 72, in wrapper
res = f(*args, **kwargs)
File "D:\Python\Python37\lib\site-packages\airtest\core\api.py", line 411, in exists
pos = loop_find(v, timeout=ST.FIND_TIMEOUT_TMP)
File "D:\Python\Python37\lib\site-packages\airtest\utils\logwraper.py", line 72, in wrapper
res = f(*args, **kwargs)
File "D:\Python\Python37\lib\site-packages\airtest\core\cv.py", line 59, in loop_find
screen = G.DEVICE.snapshot(filename=None)
File "D:\Python\Python37\lib\site-packages\airtest\core\android\android.py", line 218, in snapshot
screen = self.minicap.get_frame_from_stream()
File "D:\Python\Python37\lib\site-packages\airtest\core\android\minicap.py", line 24, in wrapper
return func(inst, *args, **kwargs)
File "D:\Python\Python37\lib\site-packages\airtest\core\android\minicap.py", line 325, in get_frame_from_stream
self.frame_gen = self.get_stream()
File "D:\Python\Python37\lib\site-packages\airtest\utils\snippet.py", line 106, in ready_func
return func(inst, *args, **kwargs)
File "D:\Python\Python37\lib\site-packages\airtest\core\android\minicap.py", line 219, in get_stream
stopped = next(gen)
File "D:\Python\Python37\lib\site-packages\airtest\core\android\minicap.py", line 233, in _get_stream
proc, nbsp, localport = self._setup_stream_server(lazy=lazy)
File "D:\Python\Python37\lib\site-packages\airtest\core\android\minicap.py", line 289, in _setup_stream_server
params, display_info = self._get_params()
File "D:\Python\Python37\lib\site-packages\airtest\core\android\minicap.py", line 185, in get_params
display_info = self.ori_function()
File "D:\Python\Python37\lib\site-packages\airtest\core\android\android.py", line 546, in get_display_info
display_info = self.minicap.get_display_info()
File "D:\Python\Python37\lib\site-packages\airtest\utils\snippet.py", line 106, in ready_func
return func(inst, *args, **kwargs)
File "D:\Python\Python37\lib\site-packages\airtest\core\android\minicap.py", line 149, in get_display_info
display_info = json.loads(display_info)
File "D:\Python\Python37\lib\json_init
.py", line 348, in loads
return _default_decoder.decode(s)
File "D:\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[04:25:09][DEBUG]<airtest.core.android.adb> D:\Python\Python37\lib\site-packages\airtest\core\android\static\adb\windows\adb.exe -P 5037 -s 127.0.0.1:62001 forward --remove tcp:12601
[04:25:09][DEBUG]<airtest.core.android.rotation> orientationWatcher has ended

Unable to run since the apk path and devicelist is null

Hi,
Sorry for using English because I don't know much as Chinese, I'm really interesting about your framework, it would be a big help for me when performing the automation testing.

But I'm got a trouble with the config.ini file, so could you please help me to clarify some point as below:

1 - Does it should work when we using ADB via USB?
2 - If the application already installed in device, do we need the APK path?

I really appreciate your help and really exciting your framework.

Thanks a lot.

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.