目录
错误收集
D:\Program\Util\python.exe C:\Users\Administrator\PycharmProjects\Appium_Real\demo.py
Traceback (most recent call last):
File "C:\Users\Administrator\PycharmProjects\Appium_Real\demo.py", line 12, in <module>
do_driver = webdriver.Remote('127.0.0.1:4723',options=UiAutomator2Options().load_capabilities(cap))
File "D:\Program\Util\Lib\site-packages\appium\webdriver\webdriver.py", line 253, in __init__
super().__init__(
~~~~~~~~~~~~~~~~^
command_executor=command_executor,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
client_config=client_config,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "D:\Program\Util\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 261, in __init__
self.start_session(capabilities)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "D:\Program\Util\Lib\site-packages\appium\webdriver\webdriver.py", line 344, in start_session
response = self.execute(RemoteCommand.NEW_SESSION, w3c_caps)
File "D:\Program\Util\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 454, in execute
self.error_handler.check_response(response)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "D:\Program\Util\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 232, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.tal.kaoyan' application. Consider checking the driver's troubleshooting documentation. Original error: Cannot start the 'com.tal.kaoyan' application. Consider checking the driver's troubleshooting documentation. Original error: Activity name '.SplashActivity' used to start the app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.tal.kaoyan' application. Consider checking the driver's troubleshooting documentation. Original error: Cannot start the 'com.tal.kaoyan' application. Consider checking the driver's troubleshooting documentation. Original error: Activity name '.SplashActivity' used to start the app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
at getResponseForW3CError (D:\Program\Util\nvm\nvm\v16.20.2\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\errors.js:1143:9)
at asyncHandler (D:\Program\Util\nvm\nvm\v16.20.2\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\protocol.js:487:57)Process finished with exit code 1
错误分析
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.tal.kaoyan' application. Consider checking the driver's troubleshooting documentation. Original error: Cannot start the 'com.tal.kaoyan' application. Consider checking the driver's troubleshooting documentation. Original error: Activity name '.SplashActivity' used to start the app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.tal.kaoyan' application. Consider checking the driver's troubleshooting documentation. Original error: Cannot start the 'com.tal.kaoyan' application. Consider checking the driver's troubleshooting documentation. Original error: Activity name '.SplashActivity' used to start the app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
看上面的东西,我们发现应该是没有找到这个活动页的启动,可能是路径填写错误了
使用 adb shell dumpsys window | find 'mCurrentFocus
查找当前界面'
再检查配置代码,发现这个出现了错误,没有填写完整的路径
解决办法
把完整的类填写上去
或者
写成下面的这样,可以省略共有的前缀
ui.activity.SplashActivity
运行结果
已经可以正常使用了