Python+Appium learning to start mobile browser

pycharm中python脚本如下:
from appium import webdriver

desired_caps ={
'platformName':'Android',
'deviceName':'127.0.0.1:62001',
'platformVersion':'6.0',
'appPackage':'com.android.browser',
'appActivity':'com.android.browser/.BrowserActivity'
}
webdriver.Remote('http://127.0.0.1:4723/wd/hub',desired_caps)



 Script Explanation:

platformName: mobile phone system

deviceName: can be viewed in adb with adb devices

platformVersion: Android system version

appPackage: can be viewed in adb with the adb shell pm list package command

 

appActivity: in adb

Clear logs with adb logcat -c

Then with adb logcat ActivityManager:I *:s

Then open the software of the laucherActivity you want to view, after opening it will display the name of the software's laucherActivity

 

 

 

 

1. Open the night god simulator, first connect the night god simulator under DOS

adb.exe connect 127.0.0.1:62001

adb devices to check whether the connection is successful; as shown in the figure, the connection is successful


2. Start the Appium service:

Set the default browser before starting Appium: Click the robot icon on Appium and check Use Browser: Browser
Start the Appium service: it is a triangle before startup, and a square after startup, as shown below:

 

 3. Run the Python script

At this time, the browser on the night god simulator will be opened automatically; at the same time, an unlock icon will be generated on the desktop

 

Perfect

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325260280&siteId=291194637