首页 文章

无法使用python在Android上的appium 1.14.16中执行滚动

提问于
浏览
0

这是我的代码

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4.2'
desired_caps['deviceName'] = 'Gaurav'
# Returns abs path relative to this file and not cwd
#desired_caps['app'] = os.path.abspath(os.path.join(os.path.dirname(__file__), 'ApiDemos-debug.apk'))
desired_caps['app'] = os.path.abspath(os.path.join(os.path.dirname(__file__), 'ragga.apk'))
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
driver.implicitly_wait(100)
driver.find_element_by_id('com.raaga.android:id/skip_text').click()
driver.find_element_by_id('com.raaga.android:id/landing_skip_to_raaga').click()
driver.find_element_by_name('Hindi').click()
e1 = driver.find_element_by_android_uiautomator('new UiSelector().text("Most Popular")')
e2 = driver.find_element_by_android_uiautomator('new UiSelector().text("Remix")')
print e1,e2
driver.scroll(e1, e2)

我想要执行滚动但在屏幕上它没有执行任何操作 . 这是android设备的截图

enter image description here

以下是Appium服务器日志:

info:[debug] [BOOTSTRAP] [debug]已注册的崩溃观察者 . info:[debug] [BOOTSTRAP] [debug]客户端连接信息:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“wake”,“params”: {}} info:[debug] [BOOTSTRAP] [debug]获得类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:唤醒信息:[debug] [BOOTSTRAP] [debug]返回结果:{ “value”:true,“status”:0} info:[debug]执行cmd:C:\ sdk \ platform-tools \ adb.exe -s 4d001f6ab48f90e9 shell“dumpsys window”info:[debug]屏幕已解锁,继续 . info:[debug]将命令推送到appium工作队列:[“getDataDir”,{}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“ getDataDir“,”params“:{}} info:[debug] [BOOTSTRAP] [debug]得到类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:getDataDir info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:“/ data / local / tmp”,“status”:0} info:[debug] dataDir设置为:/ data / local / tmp info:[debug]将命令推送到appium work queue:[“compressedLayoutHierarchy”,{“compressLayout”:false}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“ params“:{”compressLayout“:false}} info:[debug] [BOOTSTRAP] [debug]得到类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:compressedLayoutHierarchy info:[debug] [BOOTSTRAP ] [debug]返回结果:{“value”:false,“status”:0} info:[debug]获取设备API级别信息:[debug]执行cmd:C:\ sdk \ platform-tools \ adb.exe -s 4d001f6ab48f90e9 shell“getprop ro.build.version.sdk”info:[debug]设备处于API级别19信息:[debug]执行cmd:C:\ sdk \ platform-tools \ adb.exe - s 4d001f6ab48f90e9 shell“am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.raaga.android/com.raaga.android.SplashScreen”info:[debug]等待pkg“com.raaga.android”和活动“com.raaga.android.SplashScreen”成为焦点信息:[debug]获得专注的包和活动信息:[debug]执行cmd:C:\ sdk \ platform-tools \ adb.exe -s 4d001f6ab48f90e9 shell“dumpsys window windows”info:[debug]执行cmd:C:\ sdk \ platform-tools \ adb.exe -s 4d001f6ab48f90e9 shell“getprop ro.build.version.release”info:[ debug]设备发布版本为4.4.2 info:[debug]设备已启动!准备命令信息:[debug]将命令超时设置为默认值60秒信息:[debug] Appium会话以sessionId 2c7f4312-23aa-4b5d-8b65-ae1f012797d0信息开始:< - POST / wd / hub / session 303 16699.167 ms - 74 info: - > GET / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 {} info:[debug]成功响应客户端:{“status”:0,“value”:{ “平台”: “LINUX”, “browserName”: “机器人”, “platformVersion”: “4.4.2”, “webStorageEnabled”:假的, “takesScreenshot”:真实的, “javascriptEnabled”:真实的, “databaseEnabled”:假的, “networkConnectionEnabled”:真 “locationContextEnabled”:假, “警告”:{}, “期望的”:{ “platformVersion”: “4.4.2”, “设备名”: “高拉夫”, “应用程序”:“C:\用户\ Gaurav.Kumar管理员\ PycharmProjects \ NewTest \学习\30天\ APPS \ ragga.apk “ ”platformName“: ”安卓“}, ”设备名称“: ”4d001f6ab48f90e9“, ”应用程序“:” C:\用户\ Gaurav.Kumar-admin \ PycharmProjects \ NewTest \ Learning \ thirtyday \ apps \ ragga.apk“,”platformName“:”Android“},”sessionId“:”2c7f4312-23aa-4b5d-8b65-ae1f012797d0“}信息:< - - GET / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 200 4.702 ms - 663 {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android” “platformVersion”: “4.4.2”, “webStorageEnabled”:假的, “takesScreenshot”:真实的, “javascriptEnabled”:真实的, “databaseEnabled”:假的, “networkConnectionEnabled”:真实的, “locationContextEnabled”:假的, “警告” :{}, “期望的”:{ “platformVersion”: “4.4.2”, “设备名”: “高拉夫”, “应用程序”:“C:\用户\ Gaurav.Kumar管理员\ PycharmProjects \ NewTest \学习\30天\ APPS \ ragga.apk “ ”platformName“: ”安卓“}, ”设备名称“: ”4d001f6ab48f90e9“, ”应用程序“:” C:\用户\ Gaurav.Kumar管理员\ PycharmProjects \ NewTest \学习\30天\ APPS \ ragga.apk“,”platformName“:”Android“},”sessionId“:”2c7f4312-23aa-4b5d-8b65-ae1f012797d0“}信息: - > POST / wd / hub / session / 2c7f4312-23aa-4b5d- 8b65-ae1f012797d0 /超时/ implicit_wait{“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”,“ms”:100000} info:[debug]将Android隐式等待设置为100000ms信息:[debug]成功响应客户端:{“status”: 0,“value”:null,“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”} info:< - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / timeouts / implicit_wait 200 2.776 ms - 76 {“status”:0,“value”:null,“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”}信息: - > POST / wd / hub / session / 2c7f4312-23aa -4b5d-8b65-ae1f012797d0 / element {“using”:“id”,“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”,“value”:“com.raaga.android:id / skip_text”} info :[debug]等待条件信息最多100000ms:[debug]将命令推送到appium工作队列:[“find”,{“strategy”:“id”,“selector”:“com.raaga.android:id/skip_text “,”context“:”“,”multiple“:false}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{”cmd“:”action“,”action“:”find“,” PARAMS “:{” 策略 “:” ID “ ”选择“:” com.raaga.android:id/skip_text","context":"","multiple":fa lse}} info:[debug] [BOOTSTRAP] [debug]获得类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]查找com.raaga .android:id / skip_text使用带有contextId的ID:multiple:false info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0,RESOURCE_ID = com.raaga.android:id / skip_text] info:[debug ] [BOOTSTRAP] [debug]找不到元素 . 清除辅助功能缓存并重试 . info:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.raaga.android:id/skip_text:multiple:false info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0,RESOURCE_ID = com.raaga.android:id/skip_text] info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:“找不到元素”,“status”:7} info:[debug]等待911ms到目前为止信息:[debug]将命令推送到appium工作队列:[“find”,{“strategy”:“id”,“selector”:“com.raaga.android:id/skip_text","context”:“” ,“multiple”:false}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy”: “id”,“selector”:“com.raaga.android:id/skip_text","context":"","multiple":false}} info:[debug] [BOOTSTRAP] [debug]得到类型为ACTION的命令info:[debug] [BOOTSTRAP] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.raaga.android:id/skip_text:multiple:false info:[debug ] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0, RESOURCE_ID = com.raaga.android:id / skip_text] info:[debug] [BOOTSTRAP] [debug]无法定位元素 . 清除辅助功能缓存并重试 . info:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.raaga.android:id/skip_text:multiple:false info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0,RESOURCE_ID = com.raaga.android:id/skip_text] info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:“找不到元素”,“status”:7} info:[debug]等待1510ms到目前为止信息:[debug]将命令推送到appium工作队列:[“find”,{“strategy”:“id”,“selector”:“com.raaga.android:id/skip_text","context”:“” ,“multiple”:false}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy”: “id”,“selector”:“com.raaga.android:id/skip_text","context":"","multiple":false}} info:[debug] [BOOTSTRAP] [debug]得到类型为ACTION的命令info:[debug] [BOOTSTRAP] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.raaga.android:id/skip_text:multiple:false info:[debug ] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0 ,RESOURCE_ID = com.raaga.android:id / skip_text] info:[debug] [BOOTSTRAP] [debug]无法定位元素 . 清除辅助功能缓存并重试 . info:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.raaga.android:id/skip_text:multiple:false info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0,RESOURCE_ID = com.raaga.android:id/skip_text] info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:“找不到元素”,“status”:7} info:[debug]等待2023ms到目前为止信息:[debug]将命令推送到appium工作队列:[“find”,{“strategy”:“id”,“selector”:“com.raaga.android:id/skip_text","context”:“” ,“multiple”:false}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy”: “id”,“selector”:“com.raaga.android:id/skip_text","context":"","multiple":false}} info:[debug] [BOOTSTRAP] [debug]获得命令类型ACTION信息:[debug] [BOOTSTRAP] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.raaga.android:id/skip_text:multiple:false info :[debug] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0,RESOURCE_ID = com.raaga.android:id / skip_text] info:[debug] [BOOTSTRAP] [debug]找不到元素 . 清除辅助功能缓存并重试 . info:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.raaga.android:id/skip_text:multiple:false info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0,RESOURCE_ID = com.raaga.android:id/skip_text] info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:“找不到元素”,“status”:7} info:[debug]等待2612ms到目前为止信息:[debug]将命令推送到appium工作队列:[“find”,{“strategy”:“id”,“selector”:“com.raaga.android:id/skip_text","context”:“” ,“multiple”:false}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy”: “id”,“selector”:“com.raaga.android:id/skip_text","context":"","multiple":false}} info:[debug] [BOOTSTRAP] [debug]得到类型为ACTION的命令info:[debug] [BOOTSTRAP] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.raaga.android:id/skip_text:multiple:false info:[debug ] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0 ,RESOURCE_ID = com.raaga.android:id / skip_text] info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“ELEMENT”:“1”},“status”:0} info: [debug]成功响应客户:{“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”}信息:< - - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element 200 4407.689 ms - 87 {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”: “2c7f4312-23aa-4b5d-8b65-ae1f012797d0”}信息: - > POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element / 1 / click {“sessionId”:“2c7f4312-23aa- 4b5d-8b65-ae1f012797d0“,”id“:”1“} info:[debug]将命令推送到appium工作队列:[”element:click“,{”elementId“:”1“}] info:[debug] [ BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“1”}} info:[debug] [BOOTSTRAP ] [debug]得到类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:点击信息:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:tr ue,“status”:0} info:[debug]成功响应客户端:{“status”:0,“value”:true,“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”} info: < - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element / 1 / click 200 1047.512 ms - 76 {“status”:0,“value”:true,“sessionId”:“2c7f4312 -23aa-4b5d-8b65-ae1f012797d0“} info: - > POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element {”using“:”id“,”sessionId“:”2c7f4312- 23aa-4b5d-8b65-ae1f012797d0“,”value“:”com.raaga.android:id/landing_skip_to_raaga“} info:[debug]等待条件信息最多100000ms:[debug]将命令推送到appium工作队列:[”找到“,{”策略“:”id“,”选择器“:”com.raaga.android:id/landing_skip_to_raaga","context":"","multiple":false}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.raaga.android:id / landing_skip_to_raaga“,”context“:”“,”multiple“:false}} info:[debug] [BOOTSTRAP] [debug]得到类型为ACTION inf的命令o:[debug] [BOOTSTRAP] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.raaga.android:id/landing_skip_to_raaga:multiple:false info:[debug ] [BOOTSTRAP] [debug]使用:UiSelector [INSTANCE = 0,RESOURCE_ID = com.raaga.android:id / landing_skip_to_raaga] info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“ELEMENT” :“2”},“status”:0} info:[debug]成功响应客户端:{“status”:0,“value”:{“ELEMENT”:“2”},“sessionId”:“2c7f4312 -23aa-4b5d-8b65-ae1f012797d0“} info:< - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element 200 628.651 ms - 87 {”status“:0,”value“: {“ELEMENT”:“2”},“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”} info: - > POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element / 2 /单击{“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”,“id”:“2”} info:[debug]将命令推送到appium工作队列:[“element:click”,{“ elementId“:”2“}] info:[debug] [BOOTSTRAP] [debug]从cl获取数据ient:{“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“2”}} info:[debug][BOOTSTRAP] [debug]得到类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:点击信息:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:true,“status “:0} info:[debug]成功响应客户端:{”status“:0,”value“:true,”sessionId“:”2c7f4312-23aa-4b5d-8b65-ae1f012797d0“} info:< - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element / 2 / click 200 2494.108 ms - 76 {“status”:0,“value”:true,“sessionId”:“2c7f4312-23aa-4b5d -8b65-ae1f012797d0“} info: - > POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element {”using“:”name“,”sessionId“:”2c7f4312-23aa-4b5d- 8b65-ae1f012797d0“,”value“:”Hindi“}警告:[DEPRECATED]名称定位器策略已被弃用,将被删除 . 请改用accessibility id locator策略 . info:[debug]等待条件信息最多100000ms:[debug]将命令推送到appium工作队列:[“find”,{“strategy”:“name”,“selector”:“Hindi”,“context”:“ “,”“multiple”:false}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy” :“name”,“selector”:“Hindi”,“context”:“”,“multiple”:false}} info:[debug] [BOOTSTRAP] [debug]获得类型ACTION信息的命令:[debug] [BOOTSTRAP ] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]使用带有contextId的NAME查找印地语:multiple:false info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [描述=印地语, INSTANCE = 0] info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [TEXT = Hindi,INSTANCE = 0] info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“ELEMENT” :“3”},“status”:0} info:[debug]成功响应客户端:{“status”:0,“value”:{“ELEMENT”:“3”},“sessionId”:“2c7f4312 -23aa-4b5d-8b65-ae1f012797d0“} info:< - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b 65-ae1f012797d0 / element 200 1064.529 ms - 87 {“status”:0,“value”:{“ELEMENT”:“3”},“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”}信息: - - > POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element / 3 / click {“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”,“id”:“3”} info:[debug]将命令推送到appium工作队列:[“element:click”,{“elementId”:“3”}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”: “action”,“action”:“element:click”,“params”:{“elementId”:“3”}} info:[debug] [BOOTSTRAP] [debug]获得类型ACTION信息的命令:[debug] [ BOOTSTRAP] [debug]得到命令动作:点击信息:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:true,“status”:0} info:[debug]成功响应客户端:{“ status“:0,”value“:true,”sessionId“:”2c7f4312-23aa-4b5d-8b65-ae1f012797d0“} info:< - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element / 3 / click 200 1170.488 ms - 76 {“status”:0,“value”:true,“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”} i nfo: - > POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element {“using”:“ - android uiautomator”,“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0” ,“value”:“new UiSelector() . text(\”Most Popular \“)”} info:[debug]等待条件信息最多100000ms:[debug]将命令推送到appium工作队列:[“find”, {“strategy”:“ - android uiautomator”,“selector”:“new UiSelector() . text(\”Most Popular \“)”,“context”:“”,“multiple”:false}] info:[debug ] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“ - android uiautomator”,“selector”:“new UiSelector() . text(\“Most Popular \”)“,”context“:”“,”multiple“:false}} info:[debug] [BOOTSTRAP] [debug]得到类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]使用ANDROID_UIAUTOMATOR和contextId找到新的UiSelector() . text(“Most Popular”):multiple:false info:[debug] [ BOOTSTRAP] [debug]解析选择器:new UiSelector() . text(“Most P. opular“)info:[debug] [BOOTSTRAP] [debug] UiSelector强制类型:类java.lang.String arg:”最受欢迎“信息:[debug] [BOOTSTRAP] [debug]使用:UiSelector [TEXT =最受欢迎] info:[debug] [BOOTSTRAP] [debug]找不到元素 . 清除辅助功能缓存并重试 . info:[debug] [BOOTSTRAP] [debug]使用带有contextId的ANDROID_UIAUTOMATOR找到新的UiSelector() . text(“Most Popular”):multiple:false info:[debug] [BOOTSTRAP] [debug]解析选择器:new UiSelector( ).text(“最受欢迎”)信息:[debug] [BOOTSTRAP] [debug] UiSelector强制类型:类java.lang.String arg:“最受欢迎”信息:[debug] [BOOTSTRAP] [debug]使用:UiSelector [TEXT =最受欢迎]信息:[调试][BOOTSTRAP] [debug]返回结果:{“value”:“找不到元素”,“status”:7} info:[debug]到目前为止等待115ms info:[debug]将命令推送到appium工作队列:[“ find“,{”strategy“:” - android uiautomator“,”selector“:”new UiSelector() . text(\“Most Popular \”)“,”context“:”“,”multiple“:false}] info :[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“ - android uiautomator”,“selector” :“new UiSelector() . text(\”Most Popular \“)”,“context”:“”,“multiple”:false}} info:[debug] [BOOTSTRAP] [debug]获得类型ACTION信息的命令: [debug] [BOOTSTRAP] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]使用ANDROID_UIAUTOMATOR和contextId找到新的UiSelector() . text(“Most Popular”):multiple:false info:[ debug] [BOOTSTRAP] [debug]解析选择器:new UiSelector() . text(“Most Popular”)info:[debug] [BOOTSTRAP] [debug] UiSelector coerce type:class java.lang.String arg:“Most Popular” info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [TEXT =最受欢迎]信息:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“ELEMENT”:“4”},“status”:0} info:[debug]响应成功的客户:{“status”:0,“value”:{“ELEMENT”:“4”},“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”}信息:< - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element 200 889.782 ms - 87 {“status”:0,“value”:{“ELEMENT”:“4”},“sessionId”:“2c7f4312-23aa -4b5d-8b65-ae1f012797d0“} info: - > POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element {”using“:” - android uiautomator“,”sessionId“:”2c7f4312- 23aa-4b5d-8b65-ae1f012797d0“,”value“:”new UiSelector() . text(\“Remix \”)“} info:[debug]等待条件信息最多100000ms:[debug]将命令推送到appium工作queue:[“find”,{“strategy”:“ - android uiautomator”,“selector”:“new UiSelector() . text(\”Remix \“)”,“context”:“”,“multiple”:false }] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“ - android uiautom ator“,”selector“:”new UiSelector() . text(\“Remix \”)“,”context“:”“,”multiple“:false}} info:[debug] [BOOTSTRAP] [debug]得到命令类型ACTION信息:[debug] [BOOTSTRAP] [debug]得到命令动作:查找信息:[debug] [BOOTSTRAP] [debug]使用ANDROID_UIAUTOMATOR和contextId:multiple找到新的UiSelector() . text(“Remix”): false info:[debug] [BOOTSTRAP] [debug]解析选择器:new UiSelector() . text(“Remix”)info:[debug] [BOOTSTRAP] [debug] UiSelector强制类型:class java.lang.String arg:“ Remix“info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [TEXT = Remix] info:[debug] [BOOTSTRAP] [debug]返回结果:{”value“:{”ELEMENT“:”5“}, “status”:0} info:[debug]成功响应客户端:{“status”:0,“value”:{“ELEMENT”:“5”},“sessionId”:“2c7f4312-23aa-4b5d-8b65 -ae1f012797d0“} info:< - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / element 200 1261.892 ms - 87 {”status“:0,”value“:{”ELEMENT“:” 5“},”sessionId“:”2c7f4312-23aa-4b5d-8b65-ae1f012797d0“}信息: - > POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / touch / perform {“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”,“actions”:[{“action”:“press “ ”选项“:{ ”Y“:空, ”ד:空, ”元件“: ”4“}},{ ”动作“: ”的moveTo“, ”选项“:{ ”Y“:NULL,” x“:null,”element“:”5“}},{”action“:”release“,”options“:{}}]} info:[debug]将命令推送到appium工作队列:[”element:getLocation “,{”elementId“:”5“}] info:[debug]将命令推送到appium工作队列:[”element:getSize“,{”elementId“:”5“}] info:[debug] [BOOTSTRAP] [ debug]从客户端获取数据:{“cmd”:“action”,“action”:“element:getLocation”,“params”:{“elementId”:“5”}} info:[debug] [BOOTSTRAP] [debug ]获得类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:getLocation信息:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“y”:1182,“x “:525},”status“:0} info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{”cmd“:”action“,”action“:”element:getSize“,”params“: {“elementId”:“5”}} info:[debug] [BOOTSTRAP] [debug]得到了co类型为ACTION的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:getSize信息:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“height”:44,“width”: 118},“status”:0} info:[debug]将命令推送到appium工作队列:[“element:getLocation”,{“elementId”:“4”}] info:[debug] [BOOTSTRAP] [debug] Got来自客户端的数据:{“cmd”:“action”,“action”:“element:getLocation”,“params”:{“elementId”:“4”}} info:[debug] [BOOTSTRAP] [debug]获取命令类型ACTION信息:[debug] [BOOTSTRAP][debug]得到命令动作:getLocation info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“y”:726,“x”:478},“status”:0} info:[ debug]将命令推送到appium工作队列:[“element:getSize”,{“elementId”:“4”}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action” ,“action”:“element:getSize”,“params”:{“elementId”:“4”}} info:[debug] [BOOTSTRAP] [debug]获得类型ACTION信息的命令:[debug] [BOOTSTRAP] [ debug]得到命令动作:getSize info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“height”:76,“width”:212},“status”:0} info:[debug ]将命令推送到appium工作队列:[“element:getLocation”,{“elementId”:“5”}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”, “action”:“element:getLocation”,“params”:{“elementId”:“5”}} info:[debug] [BOOTSTRAP] [debug]获得类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug ]得到命令动作:getLocation info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“y”:1182,“x”:525 },“status”:0} info:[debug]将命令推送到appium工作队列:[“element:getSize”,{“elementId”:“5”}] info:[debug] [BOOTSTRAP] [debug]获取数据来自客户端:{“cmd”:“action”,“action”:“element:getSize”,“params”:{“elementId”:“5”}} info:[debug] [BOOTSTRAP] [debug]得到的命令类型ACTION info:[debug] [BOOTSTRAP] [debug]得到命令动作:getSize信息:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:{“height”:44,“width”:118} ,“status”:0} info:[debug]将命令推送到appium工作队列:[“element:touchDown”,{“elementId”:“4”,“x”:584,“y”:764}] info: [debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“element:touchDown”,“params”:{“elementId”:“4”,“x”: 584,“y”:764}} info:[debug] [BOOTSTRAP] [debug]获得类型ACTION信息的命令:[debug] [BOOTSTRAP] [debug]得到命令动作:touchDown信息:[debug] [BOOTSTRAP] [ debug]使用元素执行TouchDown? true x:584,y:764 info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:true,“status”:0} info:[debug]将命令推送到appium工作队列:[“element :touchMove“,{”elementId“:”5“,”x“:584,”y“:1204}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{”cmd“:”action“ ,“action”:“element:touchMove”,“params”:{“elementId”:“5”,“x”:584,“y”:1204}} info:[debug] [BOOTSTRAP] [debug]获得命令类型ACTION信息:[debug] [BOOTSTRAP] [debug]得到命令动作:touchMove信息:[debug] [BOOTSTRAP] [debug]使用元素执行TouchMove? true x:584,y:1204 info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:true,“status”:0} info:[debug]将命令推送到appium工作队列:[“element :touchUp“,{”elementId“:”5“,”x“:584,”y“:1204}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{”cmd“:”action“ ,“action”:“element:touchUp”,“params”:{“elementId”:“5”,“x”:584,“y”:1204}} info:[debug] [BOOTSTRAP] [debug]获得命令类型ACTION信息:[debug] [BOOTSTRAP] [debug]得到命令动作:touchUp信息:[debug] [BOOTSTRAP] [debug]使用元素执行TouchUp? true x:584,y:1204 info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:true,“status”:0} info:[debug]成功响应客户端:{“status” :0,“value”:true,“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”} info:< - POST / wd / hub / session / 2c7f4312-23aa-4b5d-8b65-ae1f012797d0 / touch /执行200 1912.002 ms - 76 {“status”:0,“value”:true,“sessionId”:“2c7f4312-23aa-4b5d-8b65-ae1f012797d0”}

还有一个人可以帮助滚动屏幕,当你要滚动隐藏在当前屏幕视图下方的元素

2 回答

  • 0

    首先,你可以通过以下方式完成:

    //Scroll till element which contains "Views" text If It Is not visible on screen.
    driver.scrollTo("Views");
    
    // Scroll till element which contains Tabs text.
    driver.scrollTo("Tabs");
    

    这是你可以尝试的非常简单的方法 . 如果这对您没有帮助,您可以尝试以下代码:

    Dimension size = driver.manage().window().getSize(); 
    int starty = (int) (size.height * 0.80); 
    //Find endy point which is at top side of screen. 
    int endy = (int) (size.height * 0.20);
    //int endy = (int) (size.height * 0.10);
    //Find horizontal point where you wants to swipe. It is in middle of screen width. 
    int startx = size.width / 2; 
    
    //Swipe from Bottom to Top. 
    driver.swipe(startx, starty, startx, endy, 3000);
    

    希望这会帮助你 .

  • 0

    //创建方法名称scrollTo或您选择的任何名称,使用下面提到的代码,它将使用我们想要滚动的文本参数:(注意:这是在java中,您可以根据python语法转换)

    public void scrollTo(String text)
    {                
    driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains(\""+text+"\").instance(0))");
    }
    

相关问题