1_weditor 포 지 셔 닝 요소 위치

WEditor
설치 하 다.
github 프로젝트 주소
https://github.com/openatx/weditor
설치 코드
pip install --pre --upgrade weditor

다음 과 같이 표시 하면 설치 성공
C:\Users\Administrator.PC-20170907TLUD>pip install --pre --upgrade weditor
Collecting weditor
  Downloading https://files.pythonhosted.org/packages/90/8b/f886be1af89c3444d688a1edf843b99532be72d6800ef6f2bbcc9c65ff77/weditor-0.0.4.dev9.tar.gz (1.2MB)
    100% |████████████████████████████████| 1.2MB 976kB/s
Collecting tornado>=4.3 (from weditor)
  Downloading https://files.pythonhosted.org/packages/e1/17/83cecc0ff2f200d9b7160e67726b2f419c53453bbe22929582fb08fe9122/tornado-5.1b1.tar.gz (516kB)
    100% |████████████████████████████████| 522kB 2.0MB/s
  Requested tornado>=4.3 from https://files.pythonhosted.org/packages/e1/17/83cecc0ff2f200d9b7160e67726b2f419c53453bbe22929582fb08fe9122/tornado-5.1b1.tar.gz#sha256=b640a110c98dfea03554120463bd4cd675f3245f15111c8893773620c03db15f (from weditor), but installing version 4.5.2
Collecting futures>=3.0.5 (from weditor)
  Downloading https://files.pythonhosted.org/packages/cc/26/b61e3a4eb50653e8a7339d84eeaa46d1e93b92951978873c220ae64d0733/futures-3.1.1.tar.gz
Requirement already up-to-date: six in c:\users\administrator.pc-20170907tlud\appdata\local\programs\python\python35\lib\site-packages (from weditor)
Collecting pillow (from weditor)
  Downloading https://files.pythonhosted.org/packages/ab/d2/d27a21bd3e64db1ca1dc7dc16026a16d77f5c3ffca9ec619eddeea7c47ce/Pillow-5.1.0-cp35-cp35m-win_amd64.whl (1.6MB)
    100% |████████████████████████████████| 1.6MB 747kB/s
Building wheels for collected packages: weditor, tornado, futures
  Running setup.py bdist_wheel for weditor ... done
  Stored in directory: C:\Users\Administrator.PC-20170907TLUD\AppData\Local\pip\Cache\wheels\43\29\78\ab5d01cff3bb4b396ec21f9c7b18b8c4448349bffa94d50137
  Running setup.py bdist_wheel for tornado ... done
  Stored in directory: C:\Users\Administrator.PC-20170907TLUD\AppData\Local\pip\Cache\wheels\66\c9\52\2cfc6fe979b8a3378aecfccea025b5f2303ad1ddd12846d57c
  Running setup.py bdist_wheel for futures ... done
  Stored in directory: C:\Users\Administrator.PC-20170907TLUD\AppData\Local\pip\Cache\wheels\f3\f9\c7\4fbf1faa6038faf183f6e3ea61f17a5f7eea5ab9a1dd7753fd
Successfully built weditor tornado futures
Installing collected packages: tornado, futures, pillow, weditor
  Found existing installation: tornado 4.5.2
    Uninstalling tornado-4.5.2:
      Successfully uninstalled tornado-4.5.2
  Found existing installation: Pillow 4.3.0
    Uninstalling Pillow-4.3.0:
      Successfully uninstalled Pillow-4.3.0
Successfully installed futures-3.1.1 pillow-5.1.0 tornado-5.1b1 weditor-0.0.4.dev9
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

다음 코드 실행
python -m weditor

브 라 우 저 에서 뛰 어 내 려 핸드폰 view 보기
보기 페이지 를 업데이트 하려 면 reload 단 추 를 누 르 십시오.
와 이 파이 네트워크 링크 는 기기 IP (192.168.3.1.234) 를 직접 입력 하고 커 넥 트 버튼 을 클릭 할 수 있다.
import uiautomator2 as u2
from time import sleep

d = u2.connect('192.168.31.234')

#   App
d.app_start("com.meizu.mzbbs")

#   
d(resourceId="com.meizu.mzbbs:id/j0").click()

#      
d(resourceId="com.meizu.mzbbs:id/p9").set_text("flyme")

#     
d(resourceId="com.meizu.mzbbs:id/tp").click()

sleep(2)

#   app
d.app_stop("com.meizu.mzbbs") 

app_start () 와 appstop () 은 시작 과 정지 에 사 용 됩 니 다.
자주 사용 하 는 포 지 셔 닝 방식:
ResourceId 포 지 셔 닝:
d(resourceId="com.meizu.mzbbs:id/tp").click()

텍스트 위치 지정:
d(text="  ").click()

설명 위치:
d(description="..").click()

클래스 이름 위치:
d(className="android.widget.TextView").click()

좋은 웹페이지 즐겨찾기