启动手机自带的浏览器:
from time import sleep
from appium import webdriver
class TestBrowser:
def setup_method(self):
desire_caps = {
"platformName": "android",
"platformVersion": "12",
"deviceName": "127.0.0.1:7555",
"appPackage": "com.android.browser",
"appActivity": ".BrowserActivity",
"chromedriverExecutable": "E:/Testing/tools/chromedriver_win32", # 可不写chromedriver驱动位置
"noReset": True,
"fullRest": True
}
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desire_caps)
self.driver.implicitly_wait(10)
def tearDown_method(self):
pass
# self.driver.quit()
def test_browser(self):
self.driver.get('http://m.baidu.com/')
print("001")
print(self.driver.contexts)
print(type(self.driver.contexts))
https://www.cnblogs.com/w-c-y/p/15758466.htmlhttps://www.cnblogs.com/w-c-y/p/15758466.html