Appium 发现一个 Appium 的 bug

西门吹牛 · 2014年08月15日 · 最后由 唐僧之妈 回复于 2014年08月19日 · 2274 次阅读

今天在 Mac 上用 Appium 做自动化测试时,发现了工具的一个 bug, appium 的版本是 1.2.0

self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIATextView[1]").send_keys("周末了!".decode('utf-8'))
self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIATextView[1]").click()
self.driver.find_element_by_name("发送").click()
self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIATextView[1]").send_keys("Happy Weekend! !@#$%^&*()_+ ")

中文输入是 ok 的,英文输入也是 ok 的,如果英文加特殊字符 “!@#$%&*()_+ ”,必定会 crash.

试过多次,就是这串特殊字符会导致 crash, 大家有没有遇到过?

共收到 6 条回复 时间 点赞

可能是多字节编码引发的吧. 这个发现不错. 赞一个, 你能定位出来就更牛了.

我试了,没有问题,不会 Crash
我的写法是:

text = self.driver.find_element_by_xpath('//UIATextView[1]')
text.send_keys(u'早上大雾,这会暴晒啊 !@#$%^&*()_+')

@seveniruby 谢谢鼓励!

@xiaomayi0323 你用一串英文加那个特殊字符试试看,反正我是每次都会 crash.

#4 楼 @beerbox 你们两个的系统是不一样的吧

#4 楼 @beerbox 恩,这样写也出现了和你一样的错误

debug: Appium request initiated at /wd/hub/session/8e50d968-8bae-47d6-aa07-dc48ea0102db/element/4/value
debug: Request received with params: {"sessionId":"8e50d968-8bae-47d6-aa07-dc48ea0102db","id":"4","value":["H","a","p","p","y"," ","W","e","e","k","e","n","d","!"," ","!","@","#","$","%","^","&","*","(",")","_","+","1"]}
debug: Pushing command to appium work queue: "au.getElement('4').setValueByType('Happy Weekend! !@#$%^&*()_+1')"
debug: Sending command to instruments: au.getElement('4').setValueByType('Happy Weekend! !@#$%^&*()_+1')
debug: Sending command to instruments: au.getElement('4').setValueByType('Happy Weekend! !@#$%^&*()_+1')

debug: [INST] 2014-08-18 06:25:46 +0000 Debug: Got new command 15 from instruments: au.getElement('4').setValueByType('Happy Weekend! !@#$%^&*()_+1')


debug: [INST] 2014-08-18 06:25:46 +0000 Debug: evaluating au.getElement('4').setValueByType('Happy Weekend! !@#$%^&*()_+1')


debug: [INST] 2014-08-18 06:25:46 +0000 Debug: target.frontMostApp().elements()[0].elements()[2].tap()


debug: [INST] 2014-08-18 06:25:47 +0000 Debug: target.frontMostApp().elements()[0].elements()[2].tap()


debug: [IOS_SYSLOG_ROW ] Aug 18 14:25:47 zhoude-iPhone MobileGestaltHelper[77] <Error>: libMobileGestalt MobileGestalt.c:267: server_access_check denied access to question UniqueDeviceID for pid 488

debug: [IOS_SYSLOG_ROW ] Aug 18 14:25:47 zhoude-iPhone ScriptAgent[488] <Error>: libMobileGestalt MobileGestaltSupport.m:167: pid 488 (ScriptAgent) does not have sandbox access for re6Zb+zwFKJNlkQTUeT+/w and IS NOT appropriately entitled

debug: [IOS_SYSLOG_ROW ] Aug 18 14:25:47 zhoude-iPhone ScriptAgent[488] <Error>: libMobileGestalt MobileGestalt.c:528: no access to UniqueDeviceID (see <rdar://problem/11744455>)

debug: [INST] 2014-08-18 06:25:47 +0000 Debug: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().keyboard()
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册