当前位置:网站首页>App automated testing appium Tutorial Part 1 - advanced supplementary content
App automated testing appium Tutorial Part 1 - advanced supplementary content
2022-06-28 08:10:00 【zhizhi0920】
app automated testing appium Outside the tutorial 1—— Advanced supplement
blend app test
blend app, That is, a app It doesn't just contain native parts , Also embedded h5 Webpage .
Use appium Framework for Android hybrid app To test , You need to switch from native to h5 Webpage ,
You must switch to the corresponding webview, The steps are as follows :
1. open app Inside webview debug Pattern
Method 1 :app Modify... In code
app What's in the code WebView A static method is called in the class setWebContentsDebuggingEnabled:
webView.setWebContentsDebuggingEnabled(true);
Method 2 : Force on Android webview debug Pattern
Because method 1 needs to find the developer to modify the code , More trouble , And when tested in a formal environment , Turn on debug Patterns can easily cause program instability , Therefore, method 2 can be used , Force on Android webview debug Pattern
notes : This method requires root, Therefore, it is recommended to use... In the simulator
step :
1)root equipment
mumu Simulator : Set up the center - Basic settings -root jurisdiction - Check open 

2) install xposed frame
xposed Download address
3) install xposed webview debugging modular
xposed webview debugging Download address
find “…\WebViewDebugHook-master\app\release\app-release.apk” install
4) take 2) and 3) Install to mumu Simulator
5) Activate Xposed
(1) open Xposed Installer
(2) install / Click... At the update ( The picture shows the installed )
(3) Check... In the module WebViewDebugHook
2. Verify if it is mixed app
Print out the current mobile page contex(python, Later Wen Tong )
print(driver.contexts)
If you return two elements, one ’NATIVE_APP’, One ’WEBVIEW’, The description contains h5 page
3. Switch to H5 page
driver.switch_to.context(‘WEBVIEW’)
Check if the switch is successful
print driver.current_context
4. Switch back to native app
driver.switch_to.context(‘NATIVE_APP’)
5. chrome debugging Webview
Open Google browser , stay Chrome://inspect debug
Pay attention to make sure that the webview Version and appium Medium chromedriver To correspond
Author's speech :
I failed in this step , In theory, it should be converted into H5 After the page , In the Chrome://inspect See the simulator H5 Page information , But I forced it open Android webview debug After the model , Input >print(driver.contexts) When verifying , No, “webview” Back to ,Chrome://inspect I can't see the simulator H5 Page information , But you can directly follow the original app The way was tested .
I don't know why , If this step is implemented later , And then add
appium The inspector records the script ( quote )
边栏推荐
猜你喜欢
随机推荐
Explanation and application of instr() function in Oracle
Hj21 simple password
MySQL two table connection principle (understand join buf)
Soft exam -- software designer -- afternoon question data flow diagram DFD
MySQL single table access method
HJ string sort
Activity隐式跳转
Eslint syntax monitoring off
Introduction to Devops Basics
asp. Net upload image path and image name
【js】-【节流、防抖函数】
Airflow2.1.1 ultra detailed installation document
挖财注册开户靠谱吗?安全吗?
HJ delete the character with the least number of occurrences in the string
Configuring multiple instances of MySQL under Linux
B_ QuRT_ User_ Guide(28)
flex布局
Host is not allowed to connect to this MySQL server
Kubernetes理论基础
js取整的小技巧









