weditor positioning

Foreword

android sdk which comes uiautomatorviewer.bat can see the elements on the phone app, but not easy to use, Internet found a large cattle write weditor, the next trial is still pretty good
python environment: 3.6

weditor environment ready

Use pip install weditor, github address https://github.com/openatx/weditor

pip install --pre weditor

Create a desktop shortcut icon

python -m weditor --shortcut

Once created, the desktop will be a WEditor shortcut icon, you can double-click to start the

You can not create an icon to start using the command line

python -m weditor

See the following message window appears, it is to launch a success (do not turn off the window)

C:\Users\dell>python -m weditor
listening on http://192.168.1.125:17310
[I 190717 23:50:55 web:2246] 304 GET / (::1) 7.98ms [I 190717 23:50:55 web:2246] 304 GET /static/libs/css/buttons.css (::1) 196.47ms [I 190717 23:50:55 web:2246] 304 GET /static/loading.svg (::1) 5.99ms [I 190717 23:50:55 web:2246] 304 GET /static/ace/ace.js (::1) 12.97ms [I 190717 23:50:55 web:2246] 304 GET /static/running.svg (::1) 13.96ms [I 190717 23:50:55 web:2246] 304 GET /static/ace/mode-python.js (::1) 19.96ms [I 190717 23:50:55 web:2246] 304 GET /static/libs/fontawesome/css/font-awesome.min.css (::1) 1.99ms [I 190717 23:50:59 web:2246] 304 GET /api/v1/version (::1) 0.00ms

weditor connect the phone

On first use adb connect the phone, enter adb devices view the phone device number: emulator-5554

C:\Users\dell>adb devices
List of devices attached
adb server version (31) doesn't match this client (40); killing... * daemon started successfully emulator-5554 device

Enter the number of mobile devices on the page, point Connet button to see the emergence of a grass icon is connection is successful

Page elements grab

Positioned elements

The method of positioning elements support uiautomator positioning method, and can also support xpath coordinate positioning

  • 1. resourceId can view the properties of the elements
  • 2. The method of automatically generating positioning xpath
  • 3. Click coordinate support, according to the proportion of the screen
  • 4. The method of automatically generating the reference codes positioning uiautomator
  • The check can be used to force xpath

Coding Debugging

You can debug the code to run on the right side of the page, this is a lot stronger than appium, you can write code to debug side, still very convenient

Steps: Check Point after high-speed rail motor car, point query button

d(resourceId="com.yipiao:id/checkGaotie").click()
d.xpath('//*[@resource-id="com.yipiao:id/layQueryCard"]/android.widget.FrameLayout[1]').click()

Ctr+EnterRun the code, you will find the phone has been successfully click

Support wifi connection

First, ensure that the computer and cell phone wifi in a local area network, the computer can ping through the phone's ip, enter ip mobile phones can also catch the page elements on your phone

Guess you like

Origin www.cnblogs.com/dreamhighqiu/p/11283162.html