#15 楼 @galactics 貌似也不支持 swipe 方法
#6 楼 @cpfeng0124 具体是怎么解决的呢,是你 driver.get("http://m.baidu.com/baidu.com 然后再点击搜索按钮吗?");改成模拟去网址栏输入
#4 楼 @galactics 只好能把详细错误给出来,不然没办法帮你分析
self.driver.tap([(500, 500)]) 这个写的不对吧,应该是 self.driver.tap([(89,109),]) 这种格式吧,我说的是 python 啊
#23 楼 @a63307517 最上方的改成 #coding=utf-8 这个放在第一行,试试。
刚入门 appium 者的福音,感谢分享
#6 楼 @seveniruby 现在不是又 appiumlibrary 吗?不能直接调用吗?为什么还要这样写呢
#4 楼 @mads 现在大家工作都这么忙,还能进行分享,真的分享感谢,感谢 @chenhengjie123昨天晚上的分享,感谢分享的每一个人。
@chenhengjie123 谢谢及时的分享,32 个赞。下一步再研究下这三层之间的相互调用实现。
#4 楼 @chenhengjie123 我在官网看 autoLaunch Whether to have Appium install and launch the app automatically. Default true true, false 默认是 true,但是我发现我两次运行 app 间隔时间较长时间,还是会提示让我安装 appium 的输入法,如果两次运行间隔很短,是不会让我重新安装 appium 的输入法的,还得具体再分析下原因
#1 楼 @chenhengjie123 unlock.apk 和 appium 的输入法能怎么设置不让他每次都安装吗?
#3 楼 @chenhengjie123 最直接是不是可以把占用 9515 端口的应用关闭点?然后再运行脚本
#57 楼 @cpfeng0124 好的,我稍后试试,到时候反馈个结果给大家。执行报错:
Traceback (most recent call last):
File "zb_rules.py", line 57, in test_rules
self.driver.find_elements_by_android_uiautomator("new UiSelector().className('android.view.View').getChild(new UiSelector().index(1))").click()
File "D:\Python27\lib\site-packages\appium\webdriver\webdriver.py", line 123, in find_elements_by_android_uiautomator
return self.find_elements(by=By.ANDROID_UIAUTOMATOR, value=uia_string)
File "D:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 679, in find_elements
{'using': by, 'value': value})['value']
File "D:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 175, in execute
self.error_handler.check_response(response)
File "D:\Python27\lib\site-packages\appium\webdriver\errorhandler.py", line 29, in check_response
raise wde
WebDriverException: Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource.
Appium 报错如下
info: --> POST /wd/hub/session/f34d3f04-3964-4d6c-a0bf-777e4ae40a6e/elements {"using":"-android uiautomator","sessionId":"f34d3f04-3964-4d6c-a0bf-777e4ae40a6e","value":"new UiSelector().className('android.view.View').getChild(new UiSelector().index(1))"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"-android uiautomator","selector":"new UiSelector().className('android.view.View').getChild(new UiSelector().index(1))","context":"","multiple":true}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"-android uiautomator","selector":"new UiSelector().className('android.view.View').getChild(new UiSelector().index(1))","context":"","multiple":true}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding new UiSelector().className('android.view.View').getChild(new UiSelector().index(1)) using ANDROID_UIAUTOMATOR with the contextId: multiple: true
info: [debug] [BOOTSTRAP] [debug] Parsing selector: new UiSelector().className('android.view.View').getChild(new UiSelector().index(1))
info: [debug] [BOOTSTRAP] [debug] UiSelector coerce type: java.lang.Class arg: 'android.view.View'
info: [debug] [BOOTSTRAP] [debug] UiSelector coerce type: class java.lang.String arg: 'android.view.View'
info: [debug] Responding to client with error: {"status":9,"value":{"message":"The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource.","origValue":"Could not parse UiSelector argument: 'android.view.View' is not a string"},"sessionId":"f34d3f04-3964-4d6c-a0bf-777e4ae40a6e"}
info: <-- POST /wd/hub/session/f34d3f04-3964-4d6c-a0bf-777e4ae40a6e/elements 500 11.186 ms - 308
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"Could not parse UiSelector argument: 'android.view.View' is not a string","status":9}
info: --> DELETE /wd/hub/session/f34d3f04-3964-4d6c-a0bf-777e4ae40a6e {}
info: Shutting down appium session
#53 楼 @cpfeng0124 self.driver.find_element_by_xpath("//linearlayout//android.view.View[7]").click() 是类似这样的写法吗?//linearlayout//android.view.View[7] 根据实际几层 linearlayout 就写几个?如图这样的该怎么写呢
#37 楼 @cpfeng0124
这样的元素,该如何定位?类似你文章中的这个元素,见下图红色框
这个元素的 xpath 能给一下吗?