我的 mac 是 10.10.2 的系统,已经安装了 Appium 的 app,启动正常
然后运行 Appium 的 sample code,控制台运行结果如下
MacBook-Pro:python real$ python ios_simple.py
test_scroll (main.SimpleIOSTests) ... ERROR
test_ui_computation (main.SimpleIOSTests) ... ERROR

======================================================================

ERROR: test_scroll (main.SimpleIOSTests)

Traceback (most recent call last):
File "ios_simple.py", line 57, in test_scroll
el = self.driver.find_element_by_accessibility_id('OK')
File "build/bdist.macosx-10.10-intel/egg/appium/webdriver/webdriver.py", line 135, in find_element_by_accessibility_id
return self.find_element(by=By.ACCESSIBILITY_ID, value=id)
File "/Library/Python/2.7/site-packages/selenium-2.45.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 664, in find_element
{'using': by, 'value': value})['value']
File "/Library/Python/2.7/site-packages/selenium-2.45.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 175, in execute
self.error_handler.check_response(response)
File "build/bdist.macosx-10.10-intel/egg/appium/webdriver/errorhandler.py", line 29, in check_response
raise wde
NoSuchElementException: Message: An element could not be located on the page using the given search parameters.

======================================================================

ERROR: test_ui_computation (main.SimpleIOSTests)

Traceback (most recent call last):
File "ios_simple.py", line 42, in test_ui_computation
self._populate()
File "ios_simple.py", line 32, in _populate
els = self.driver.find_elements_by_ios_uiautomation('elements()')
File "build/bdist.macosx-10.10-intel/egg/appium/webdriver/webdriver.py", line 101, in find_elements_by_ios_uiautomation
return self.find_elements(by=By.IOS_UIAUTOMATION, value=uia_string)
File "/Library/Python/2.7/site-packages/selenium-2.45.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 679, in find_elements
{'using': by, 'value': value})['value']
File "/Library/Python/2.7/site-packages/selenium-2.45.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 175, in execute
self.error_handler.check_response(response)
File "build/bdist.macosx-10.10-intel/egg/appium/webdriver/errorhandler.py", line 29, in check_response
raise wde
WebDriverException: Message: An error occurred while executing user supplied JavaScript.


Ran 2 tests in 20.406s

FAILED (errors=2)

我的 xcode 是 6.1.1 之前没有运行过 iOS simulator

我的 Appium 的 App 上的 log 如下:
有如下 warning
warn: Applications directory /Users/real/Library/Developer/CoreSimulator/Devices/D1E53AD9-33EE-4BE7-A534-0D465845F814/data/Containers/Data/Application doesn't exist. Have you run this simulator before?
warn: Applications directory /Users/real/Library/Developer/CoreSimulator/Devices/D1E53AD9-33EE-4BE7-A534-0D465845F814/data/Containers/Bundle/Application doesn't exist. Have you run this simulator before?


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