Traceback (most recent call last):
File "E:/qa_ui_automation/qa-appium/business/pjt_app_service/android/pjt_android_operation.py", line 68, in <module>
pjto = PJTOperation()
File "E:/qa_ui_automation/qa-appium/business/pjt_app_service/android/pjt_android_operation.py", line 48, in __init__
self.driver = Driver().run_driver(self.desired_caps)
File "E:\qa_ui_automation\qa-appium\common_module\app\driverCommonPJT.py", line 21, in run_driver
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
File "E:\Python3.7\lib\site-packages\appium_python_client-0.47-py3.7.egg\appium\webdriver\webdriver.py", line 144, in __init__
File "E:\Python3.7\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "E:\Python3.7\lib\site-packages\appium_python_client-0.47-py3.7.egg\appium\webdriver\webdriver.py", line 219, in start_session
File "E:\Python3.7\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "E:\Python3.7\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created. (Original error: Requested a new session but one was in progress)
错误原因:
desired_caps 的appActivity错误
查找正确的方法:
adb shell dumpsys activity activities
查找信息:
intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.aihuihui.opt/.ui.splash.SplashActivity}
realActivity=com.aihuihui.opt/.ui.splash.SplashActivity
autoRemoveRecents=false isPersistable=true numFullscreen=1 activityType=1
rootWasReset=true mNeverRelinquishIdentity=true mReuseTask=false mLockTaskAuth=LOCK_TASK_AUTH_PINNABLE
Activities=[ActivityRecord{7c7b472 u0 com.aihuishou.opt/.ui.guide.GuideActivity t114}]
askedCompatMode=false inRecents=true isAvailable=true
mRootProcess=ProcessRecord{e061a2e 14902:com.aihuishou.opt/u0a152}
cmp=com.aihuihui.opt/.ui.splash.SplashActivity
获取如下正确信息:
'appPackage':com.aihuihui.opt 'appActivity': '.ui.splash.SplashActivity'