Appium- IOS点击某元素不生效

启动参数不对

{
"platformName": "ios",
"bundleId": "xx.xxx.xx",
"automationName": "XCUITest",
"deviceName": "iPhone",
"udid": "auto",
"xcodeOrgId": "7******S",
"xcodeSigningId": "iPhone Developer"

}

参考下这个帖子

http://appium.io/docs/en/writing-running-appium/caps/#ios-only

platformName : iOS
platformVersion: “”
udid: ‘’
deviceName: ‘’
restart: true
app: com.igetcool.app
automationName: ‘XCUITest’
noReset: True
enableWebviewDetailsCollection: True
autoGrantPermissions: True
unicodeKeyboard: True
resetKeyboard: True
newCommandTimeout: 3600
useNewWDA: True
wdaLocalPort: 8300

哪个参数不对啊,下面是全的参数

这个appium报错也不是因为启动参数报错呀,要是启动参数报错的原因,那么前面两个步骤就不应该进行,启动app以后就会报错,但是目前是,在点击清除这个元素的时候报错,并且不是每次都报错,有正确通过的时候,但不是那么稳定,所以,找到这个报错信息想问下怎么提高对应的稳定性

报错就是bundleId的问题,你改下试试

启动参数改了以后app启动都起不来了。。

bundle ID 对吗

bundle ID就是app对应的那个参数吧,就是安装软件的

这个包名吧

启动起来了

还是报错

[Xcode]     t =    30.14s Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    30.32s Find: Descendants matching type Any
[Xcode] 
[Xcode]     t =    30.32s Find: Elements matching predicate 'wdName == "清除文本" AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeerValue == 0 OR selected == 0)'
[Xcode] 
[Xcode]     t =    30.33s Find: Identity Binding
[Xcode] 
[Xcode]     t =    30.34s Tap "清除文本" Button
[Xcode] 
[Xcode]     t =    30.34s     Wait for com.igetcool.app to idle
[Xcode] 
[Xcode]     t =    30.34s     Find the "清除文本" Button
[Xcode] 
[Xcode]     t =    30.34s         Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    30.50s         Find: Descendants matching type Any
[Xcode] 
[Xcode]     t =    30.50s         Find: Elements matching predicate 'wdName == "清除文本" AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 laceholderValue == 0 OR selected == 0)'
[Xcode] 
[Xcode]     t =    30.50s         Find: Identity Binding
[Xcode] 
[Xcode]     t =    30.51s     Check for interrupting elements affecting "清除文本" Button
[Xcode] 
[Xcode]     t =    30.52s         Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    30.61s         Find: Descendants matching predicate identifier == "NotificationShortLookView" OR elementType == 7
[Xcode] 
[Xcode]     t =    30.62s     Synthesize event
[Xcode] 
[Xcode]     t =    30.66s         Scroll element to visible
[Xcode] 
[Xcode]     t =    30.66s         Failed: Failed to scroll to visible (by AX action) Button, {{273.7, 55.7}, {24.0, 24.0}}, label: '清除文本', error: Error kAXErrorCannotComplete performing AXAction 2003 on elemen element pid: 425, elementOrHash.elementID: 4843786592.282
[Xcode] 
[Xcode]     t =    31.67s     Retrying `Tap "清除文本" Button` (attempt #2)
[Xcode] 
[Xcode]     t =    31.67s         Wait for com.igetcool.app to idle
[Xcode] 
[Xcode]     t =    31.69s         Find the "清除文本" Button
[Xcode] 
[Xcode]     t =    31.69s             Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    31.87s             Find: Descendants matching type Any
[Xcode] 
[Xcode]     t =    31.88s             Find: Elements matching predicate 'wdName == "清除文本" AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled =OR placeholderValue == 0 OR selected == 0)'
[Xcode] 
[Xcode]     t =    31.88s             Find: Identity Binding
[Xcode] 
[Xcode]     t =    31.89s         Check for interrupting elements affecting "清除文本" Button
[Xcode] 
[Xcode]     t =    31.90s             Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    32.01s             Find: Descendants matching predicate identifier == "NotificationShortLookView" OR elementType == 7
[Xcode] 
[Xcode]     t =    32.02s         Synthesize event
[Xcode] 
[Xcode]     t =    32.05s             Scroll element to visible
[Xcode] 
[Xcode]     t =    32.06s             Failed: Failed to scroll to visible (by AX action) Button, {{273.7, 55.7}, {24.0, 24.0}}, label: '清除文本', error: Error kAXErrorCannotComplete performing AXAction 2003 on elt AX element pid: 425, elementOrHash.elementID: 4843786592.282
[Xcode] 
[Xcode]     t =    33.07s     Retrying `Tap "清除文本" Button` (attempt #3)
[Xcode] 
[Xcode]     t =    33.07s         Wait for com.igetcool.app to idle
[Xcode] 
[Xcode]     t =    33.09s         Find the "清除文本" Button
[Xcode] 
[Xcode]     t =    33.10s             Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    33.27s             Find: Descendants matching type Any
[Xcode] 
[Xcode]     t =    33.27s             Find: Elements matching predicate 'wdName == "清除文本" AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled =OR placeholderValue == 0 OR selected == 0)'
[Xcode] 
[Xcode]     t =    33.28s             Find: Identity Binding
[Xcode] 
[Xcode]     t =    33.28s         Check for interrupting elements affecting "清除文本" Button
[Xcode] 
[Xcode]     t =    33.29s             Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    33.39s             Find: Descendants matching predicate identifier == "NotificationShortLookView" OR elementType == 7
[Xcode] 
[Xcode]     t =    33.40s         Synthesize event
[Xcode] 
[Xcode]     t =    33.43s             Scroll element to visible
[Xcode] 
[Xcode]     t =    33.44s             Failed: Failed to scroll to visible (by AX action) Button, {{273.7, 55.7}, {24.0, 24.0}}, label: '清除文本', error: Error kAXErrorCannotComplete performing AXAction 2003 on elt AX element pid: 425, elementOrHash.elementID: 4843786592.282
[Xcode] 
[Xcode] 2020-12-05 17:33:10.215990+0800 WebDriverAgentRunner-Runner[422:34906] Enqueue Failure: Failed to synthesize event: Failed to scroll to visible (by AX action) Button, {{273.7, 55.7}, {24.0, 24.0}}, label: '清除文本', error: Error kAXErrorCannotComplete performing AXAction 2003 on element AX element pid: 425, elementOrHash.elementID: 4843786592.282. (Underlying Error: Error kAXErrorCannotComplete performing AXAction3 on element AX element pid: 425, elementOrHash.elementID: 4843786592.282) /usr/local/lib/node_modules/appium/node_modules/_appium-webdriveragent@2.31.0@appium-webdriveragent/WebDriverAgentRunner/UITestingUITests.m 39 1
[Xcode] 

发下报错信息

[Xcode] 2020-12-05 17:33:10.215990+0800 WebDriverAgentRunner-Runner[422:34906] Enqueue Failure: Failed to synthesize event: Failed to scroll to visible (by AX action) Button, {{273.7, 55.7}, {24.0, 24.0}}, label: ‘清除文本’, error: Error kAXErrorCannotComplete performing AXAction 2003 on element AX element pid: 425, elementOrHash.elementID: 4843786592.282. (Underlying Error: Error kAXErrorCannotComplete performing AXAction3 on element AX element pid: 425, elementOrHash.elementID: 4843786592.282) /usr/local/lib/node_modules/appium/node_modules/_appium-webdriveragent@2.31.0@appium-webdriveragent/WebDriverAgentRunner/UITestingUITests.m 39 1

你这个报错是你执行滑动操作失败了

1 个赞

明明是click为什么底层执行了滑动

[2020-12-05 17:33:06,749] [logging:log_info] [INFO]- click:清除文本,0
[2020-12-05 17:33:06,750] [logging:log_info] [INFO]- [HTTP] --> POST /wd/hub/session/d81a67ee-d36b-404d-96d7-73002acf39f0/element/1A010000-0000-0000-A901-000000000000/click
[2020-12-05 17:33:06,751] [logging:log_info] [INFO]- [HTTP] {"id":"1A010000-0000-0000-A901-000000000000"}
[2020-12-05 17:33:06,751] [logging:log_info] [INFO]- [W3C (d81a67ee)] Driver proxy active, passing request on via HTTP proxy
[Xcode]     t =    30.14s Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    30.32s Find: Descendants matching type Any
[Xcode] 
[Xcode]     t =    30.32s Find: Elements matching predicate 'wdName == "清除文本" AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 OR placeerValue == 0 OR selected == 0)'
[Xcode] 
[Xcode]     t =    30.33s Find: Identity Binding
[Xcode] 
[Xcode]     t =    30.34s Tap "清除文本" Button
[Xcode] 
[Xcode]     t =    30.34s     Wait for com.igetcool.app to idle
[Xcode] 
[Xcode]     t =    30.34s     Find the "清除文本" Button
[Xcode] 
[Xcode]     t =    30.34s         Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    30.50s         Find: Descendants matching type Any
[Xcode] 
[Xcode]     t =    30.50s         Find: Elements matching predicate 'wdName == "清除文本" AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled == 0 laceholderValue == 0 OR selected == 0)'
[Xcode] 
[Xcode]     t =    30.50s         Find: Identity Binding
[Xcode] 
[Xcode]     t =    30.51s     Check for interrupting elements affecting "清除文本" Button
[Xcode] 
[Xcode]     t =    30.52s         Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    30.61s         Find: Descendants matching predicate identifier == "NotificationShortLookView" OR elementType == 7
[Xcode] 
[Xcode]     t =    30.62s     Synthesize event
[Xcode] 
[Xcode]     t =    30.66s         Scroll element to visible
[Xcode] 
[Xcode]     t =    30.66s         Failed: Failed to scroll to visible (by AX action) Button, {{273.7, 55.7}, {24.0, 24.0}}, label: '清除文本', error: Error kAXErrorCannotComplete performing AXAction 2003 on elemen element pid: 425, elementOrHash.elementID: 4843786592.282
[Xcode] 
[Xcode]     t =    31.67s     Retrying `Tap "清除文本" Button` (attempt #2)
[Xcode] 
[Xcode]     t =    31.67s         Wait for com.igetcool.app to idle
[Xcode] 
[Xcode]     t =    31.69s         Find the "清除文本" Button
[Xcode] 
[Xcode]     t =    31.69s             Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    31.87s             Find: Descendants matching type Any
[Xcode] 
[Xcode]     t =    31.88s             Find: Elements matching predicate 'wdName == "清除文本" AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled =OR placeholderValue == 0 OR selected == 0)'
[Xcode] 
[Xcode]     t =    31.88s             Find: Identity Binding
[Xcode] 
[Xcode]     t =    31.89s         Check for interrupting elements affecting "清除文本" Button
[Xcode] 
[Xcode]     t =    31.90s             Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    32.01s             Find: Descendants matching predicate identifier == "NotificationShortLookView" OR elementType == 7
[Xcode] 
[Xcode]     t =    32.02s         Synthesize event
[Xcode] 
[Xcode]     t =    32.05s             Scroll element to visible
[Xcode] 
[Xcode]     t =    32.06s             Failed: Failed to scroll to visible (by AX action) Button, {{273.7, 55.7}, {24.0, 24.0}}, label: '清除文本', error: Error kAXErrorCannotComplete performing AXAction 2003 on elt AX element pid: 425, elementOrHash.elementID: 4843786592.282
[Xcode] 
[Xcode]     t =    33.07s     Retrying `Tap "清除文本" Button` (attempt #3)
[Xcode] 
[Xcode]     t =    33.07s         Wait for com.igetcool.app to idle
[Xcode] 
[Xcode]     t =    33.09s         Find the "清除文本" Button
[Xcode] 
[Xcode]     t =    33.10s             Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    33.27s             Find: Descendants matching type Any
[Xcode] 
[Xcode]     t =    33.27s             Find: Elements matching predicate 'wdName == "清除文本" AND (1 == 1 OR identifier == 0 OR frame == 0 OR value == 0 OR title == 0 OR label == 0 OR elementType == 0 OR enabled =OR placeholderValue == 0 OR selected == 0)'
[Xcode] 
[Xcode]     t =    33.28s             Find: Identity Binding
[Xcode] 
[Xcode]     t =    33.28s         Check for interrupting elements affecting "清除文本" Button
[Xcode] 
[Xcode]     t =    33.29s             Requesting snapshot of accessibility hierarchy for app with pid 425
[Xcode] 
[Xcode]     t =    33.39s             Find: Descendants matching predicate identifier == "NotificationShortLookView" OR elementType == 7
[Xcode] 
[Xcode]     t =    33.40s         Synthesize event
[Xcode] 
[Xcode]     t =    33.43s             Scroll element to visible
[Xcode] 
[Xcode]     t =    33.44s             Failed: Failed to scroll to visible (by AX action) Button, {{273.7, 55.7}, {24.0, 24.0}}, label: '清除文本', error: Error kAXErrorCannotComplete performing AXAction 2003 on elt AX element pid: 425, elementOrHash.elementID: 4843786592.282
[Xcode] 
[Xcode] 2020-12-05 17:33:10.215990+0800 WebDriverAgentRunner-Runner[422:34906] Enqueue Failure: Failed to synthesize event: Failed to scroll to visible (by AX action) Button, {{273.7, 55.7}, {24.0, 24.0}}, label: '清除文本', error: Error kAXErrorCannotComplete performing AXAction 2003 on element AX element pid: 425, elementOrHash.elementID: 4843786592.282. (Underlying Error: Error kAXErrorCannotComplete performing AXAction3 on element AX element pid: 425, elementOrHash.elementID: 4843786592.282) /usr/local/lib/node_modules/appium/node_modules/_appium-webdriveragent@2.31.0@appium-webdriveragent/WebDriverAgentRunner/UITestingUITests.m 39 1
[Xcode] 

发下代码看看

代码就是一个click啊,对应日志文件,我在上面贴出来啦

查下元素是否存在且可操作

我查了下这个报错信息,是 UITesting报错的,奇怪了
排查下看看
image

个别时候因为加载延迟或者底层框架不稳定会导致出这样的问题,一般会用一个重试机制去点击。如果点击完没效果就继续点击直到下个控件出现。用一个循环或者显式等待去重试

收到,我加上对应重试机制试试