对应步骤加上对应sleep(2)还是不能点击~
1、帖子要发在答疑区哈
2、发下代码,定位表达式看看
from time import sleep
from appium import webdriver
def initIOSDriver():
print("进入app初始化")
caps ={
"platformName": "iOS",
"deviceName": "iPhonex",
"appPackage": "com.igetcool.app",
"noReset": True,
"platformVersion": "",
"udid": "",
"automationName": "XCUITest",
"enableWebviewDetailsCollection": True,
"autoGrantPermissions": True,
"unicodeKeyboard": True,
"resetKeyboard": True,
"newCommandTimeout": 3600,
"useNewWDA": False,
"wdaLocalPort": 8200
}
driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", caps)
sleep(5)
driver.find_element_by_xpath('//XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther[2]/XCUIElementTypeOther').click()
sleep(2)
driver.find_element_by_xpath('//XCUIElementTypeSearchField').send_keys("随便写一写")
sleep(2)
driver.find_element_by_accessibility_id('清除文本').click()
initIOSDriver()
简单写了下启动的代码
对应的清除文本元素无法点击
启动参数不对
{
"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 对吗
启动起来了
还是报错
[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
你这个报错是你执行滑动操作失败了
明明是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啊,对应日志文件,我在上面贴出来啦