Appium 新手:运行一段示例代码,ios-simulator 运行报错:could not determine your device from Appium arguments

chaopioneer · 2014年12月11日 · 1573 次阅读

or desired capabilities. Please make sure to specify the 'deviceName' and 'platformName' capabilities.

示例代码:
class TestSequenceFunctions(unittest.TestCase):

def setUp(self):
# set up appium
app = os.path.join(os.path.dirname(file),
'../../apps/TestApp/build/Release-iphonesimulator',
'TestApp.app')
app = os.path.abspath(app)
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities={
'browserName': '',
'device': 'iPhone Simulator',
'platform': 'Mac',
'version': '6.0',
'app': app
})
self._values = []

def _populate(self):
# populate text fields with two random number
elems = self.driver.find_elements_by_tag_name('textField')
for elem in elems:
rndNum = randint(0, 10)
elem.send_keys(rndNum)
self._values.append(rndNum)

def test_ui_computation(self):
# populate text fields with values
self._populate()
# trigger computation by using the button
buttons = self.driver.find_elements_by_tag_name("button")
buttons[0].click()
# is sum equal ?
texts = self.driver.find_elements_by_tag_name("staticText")
self.assertEqual(int(texts[0].text), self._values[0] + self._values[1])

def tearDown(self):
self.driver.quit()

if name == 'main':

unittest.main()

我的环境:
Mac : OSX 版本 10.9.4
Xcode:5.1.1

appium : 版本 1.3.4

求解!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

共收到 3 条回复 时间 点赞

缺啥补啥 😄

desired_caps['app'] = ''
desired_caps['udid'] = ''
desired_caps['platformName'] = 'iOS'
desired_caps['platformVersion'] = '8.1.1'
desired_caps['deviceName'] = ''

#1 楼 @link1220 感谢 link 回复

新手问句题外话,为什么'platform': 是'Mac‘

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册