1.已经运行了 appium
2.安装了 selenim-3.0 和 Python client for Appium 1.5,是用 python3.5
3.from time import sleep 提示是不是有错?

/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /Users/wenbingbing/PycharmProjects/appiumtest/ContactsAndroidTests.py
test_add_contacts (__main__.ContactsAndroidTests) ... ERROR

======================================================================
ERROR: test_add_contacts (__main__.ContactsAndroidTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/wenbingbing/PycharmProjects/appiumtest/ContactsAndroidTests.py", line 23, in setUp
    self.driver = webdriver.Remote('http://127.0.0.1:4723/wb/hub', desired_caps)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/appium/webdriver/webdriver.py", line 36, in __init__
    super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 163, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: The URL '/wb/hub/session' did not map to a valid resource


----------------------------------------------------------------------
Ran 1 test in 0.017s

FAILED (errors=1)

Process finished with exit code 0


↙↙↙阅读原文可查看相关链接,并与作者交流