用命令启动的时候 如果添加了UiAutomator2会报错,麻烦老师帮忙看一下原因

来源:5-14 多进程、unittest、HTMLTestRunner、启动服务流程梳理代码重构

慕粉18210332877

2018-07-30

def get_driver():  #启动webdriver
    capabilities = {
        "platformName": "Android",
        # "platformVersion": "8.1.0",
        # "deviceName": "988a1b32454c363038",
        # "deviceName": "127.0.0.1:62001",
        "deviceName": "988a1b32454c363038",
        "automationName": "UiAutomator2",
        "app": "/Users/juntongli/Desktop/cobo_appium.apk",
    }
    # capabilities.setCapability("deviceName","Android");

    driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", capabilities)

用appium desktop运行的时候就可以正常启动,但是用命令appiium -p 4723 -bp 4600就会报错

报错信息:

Traceback (most recent call last):

  File "/Users/juntongli/Desktop/Appiumtest/case/start_appium.py", line 34, in <module>

    driver = get_driver()

  File "/Users/juntongli/Desktop/Appiumtest/case/start_appium.py", line 23, in get_driver

    driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", capabilities)

  File "/anaconda3/lib/python3.6/site-packages/Appium_Python_Client-0.26-py3.6.egg/appium/webdriver/webdriver.py", line 36, in __init__

  File "/anaconda3/lib/python3.6/site-packages/selenium-3.12.0-py3.6.egg/selenium/webdriver/remote/webdriver.py", line 156, in __init__

    self.start_session(capabilities, browser_profile)

  File "/anaconda3/lib/python3.6/site-packages/selenium-3.12.0-py3.6.egg/selenium/webdriver/remote/webdriver.py", line 245, in start_session

    response = self.execute(Command.NEW_SESSION, parameters)

  File "/anaconda3/lib/python3.6/site-packages/selenium-3.12.0-py3.6.egg/selenium/webdriver/remote/webdriver.py", line 314, in execute

    self.error_handler.check_response(response)

  File "/anaconda3/lib/python3.6/site-packages/selenium-3.12.0-py3.6.egg/selenium/webdriver/remote/errorhandler.py", line 242, 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: Could not sign with default certificate. Original error Command '/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/bin/java -jar /usr/local/lib/node_modules/appium/node_modules/_appium-adb\@6.11.1\@appium-adb/jars/sign.jar /usr/local/lib/node_modules/appium/node_modules/_appium-uiautomator2-server\@1.12.0\@appium-uiautomator2-server/apks/appium-uiautomator2-server-v1.12.0.apk --override' exited with code 1


[Finished in 2.1s with exit code 1]

[shell_cmd: python -u "/Users/juntongli/Desktop/Appiumtest/case/start_appium.py"]

[dir: /Users/juntongli/Desktop/Appiumtest/case]

[path: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS]

//img.mukewang.com/szimg/5b5e7c540001dc9211702054.jpg

写回答

2回答

Mushishi

2018-07-31

 Could not sign with default certificate 证书问题

0
1
慕粉18210332877
非常感谢!
2018-08-02
共1条回复

慕粉18210332877

提问者

2018-07-30

重新安装appium之后好了,但是原因不知道是为什么

0
0

Python主讲移动端自动化测试框架Appium

APP自动化基础知识、po模型、关键字模型、服务自动化、持续集成

1508 学习 · 1333 问题

查看课程