Recently, jumped a jump outside the fire, read the author's ideas and tutorials, feeling quite simple, but in the process of implementation (divert), encountered many problems.
One of them is the real machine debug WDA, refer to the IOS real machine How to install Webdriveragent Testerhome, follow this tutorial, conquer debugging Wda problems:
Begin
Start by following the tutorial, try to update the next version of Xcode, download the latest version of Wda from GitHub, and clone it directly to your local
Switch to the WDA root directory and run the init script
cd WebDriverAgent./Scripts/bootstrap.sh
The above script is the JS file that installs the dependent library and uses NPM to package the response. Interested students can browse the script file, in the same sibling directory there is another build.sh , you can also directly execute the scripts to compile and install WDA. Of course, the first contact, I hope that the operation of the words will be better.
If there is an error in the middle, you need to resolve it first, otherwise the next operation will not work.
Compile run
Next, open WebDriverAgent.xcodeproj the file through Xcode.
You can first try to compile, easy to locate existing problems, using a combination of keys or through the mouse operation
command + b
This time, there will definitely be a hint to configure the certificate issue, the real Machine Debug certificate must be set. You can set up a personal developer free certificate, or other paid certificate.
Then select WebDriverAgentRunner this target and the real machine device to perform the test. Key combinations command+u , or mouse actions from the menu bar product
All right, a webdriveragent app with no icon will appear on the phone, and then back to the desktop immediately after launch. It's quite normal not to be surprised.
In the application tutorial, the above behavior is normal, but it is possible to error in the console, so that the IP address can not be printed.
When all the processes have been re-smoothed, you will find that it is not possible to find out which step is wrong, and the situation I have encountered is that there is no miracle in the console. After a search, found a post in the warning, I decided to let go!
Do you think this is going to work?
Not!
One of the most critical steps:
You need to use the data cable connected to the computer to restart your phone!!!!
You need to use the data cable connected to the computer to restart your phone!!!!
You need to use the data cable connected to the computer to restart your phone!!!!
Important words to say three times!
Anyway, in the case of ensuring that the data cable is connected, reboot the phone and then rebuild to see the IP address successfully! And in the future operation, this situation will be reproduced, so restart the phone, do not waste innocent time study ~
By the IP and port given above, plus the /status composition of a URL address. For example http://10.0.0.1:8100/status , then the browser opens. If a string of JSON output appears, the WDA installation is successful.
Port forwarding
Some home-made iphone machines are not accessible via the IP and port of the phone, and the phone's port needs to be forwarded to the Mac. On this issue, I see the effect through port forwarding, so you should also encounter the same problem.
$ brew install imobiledevice$ iproxy 8100 8100 [4c47766e78f9d84e1da55b07d69f2747e9fb4f71]
A more specific usage can be found using the Iproxy--help. This is done by accessing to http://localhost:8100/status confirm that the WDA is running successfully.
And inspector's address is http://localhost:8100/inspector , Inspector is used to view the UI layer, easy to write test script.
Note: After port forwarding, the domain name is no longer the IP address, but your native IP or use the localhost + port number
Final effect
Once you've done this, you can open an app in your app and you'll see the following effect.
Combine with Appium Desktop to eat together, the effect is better ~
Good luck!!!
Actual combat
I believe you will be interested in this, through the WDA to do automated testing, well!
Next, show me how to use the ATX to open the iphone's own timer, start and then exit
#! /usr/local/bin/python3# -*- coding: utf-8 -*-import= atx.connect("http://localhost:8100")d.start_app("com.apple.mobiletimer")d(text=u‘计时器‘).click()d(text=u‘开始计时‘).click()d(text=u‘取消‘).click()d.stop_app()
Execute the above code to experience
End
The last wall crack recommendation is based on the Python Automation framework address Https://github.com/NetEaseGame/ATX
Xcode is a lot of questions, may wda with you.
Reference links
ATX documentation-How to install webdriveragent IOS Real Machine
Macaca App Inspector 2.0 released
Appium Desktop Brief Introduction--xcodebuild failed with code 65 resolution
Webdriveragent sinkhole
Start the webdriveragent and then start the Appium, run the script until the waiting for Webdriveragent to start on device
ATX Support IOS10 Mobile phone test method description
IOS Real-Computer debugging how to install Webdriveragent