从Appium服务器上,我试图获得使用python的应用程序的启动延迟时间

2024-06-12 17:55:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图直接从appium服务器查找设置应用程序的启动延迟

请您帮助我了解用python捕获细节的代码

以下是我的密码:-


from appium import webdriver

desired_cap = {
    "platformName": "Android",
    "platformVersion": "10.0",
    "deviceName": "1000686d",
    "automationName": "Appium",
    "appPackage": "com.android.settings",
    "appActivity": "com.android.settings.Settings",
    "newCommandTimeout": "600",
    "autoLaunch": "false", #this will not launch the app by itself so that we can measure the launch latency in a controlled way.
    "eventTimings": "true"
}

driver = webdriver.Remote("http://localhost:4723/wd/hub",desired_cap)

print ("Launching Settings")
driver.start_activity("com.android.settings", "com.android.settings.Settings");

server_events = driver.getEvents()

输出:-

Launching Settings
Traceback (most recent call last):
  File "C:/Users/Vinay/Desktop/Python/V2/Session_2/Launch_Latency.py", line 21, in <module>
    server_events = driver.getEvents()
AttributeError: 'WebDriver' object has no attribute 'getEvents'

Process finished with exit code 1


Tags: theincomsettingsserverdriverlaunchandroid