简体   繁体   English

如何使用appium在android中滚动listview?

[英]how to scroll a listview in android using appium?

I used the following statement to scroll . 我使用以下语句滚动。

  @driver.scroll_to_exact('Text').click

I got the following error 我收到以下错误

Selenium::WebDriver::Error::WebDriverError:unexpected response, code=404, content-type="text/plain"That URL did not map to a valid JSONWP resource

I tried using the following statement 我尝试使用以下语句

     b=find_element(:id,'com.dddd.main:id/calenderListView')
     @driver.execute_script 'mobile: scrollTo', :element => b.ref`

I was able to scroll till the end of the list view .But got the following error after scrolling to end of listview 我可以滚动到列表视图的末尾。但是滚动到列表视图的末尾后出现以下错误

  Failure/Error: @driver.execute_script 'mobile: scrollTo', :element => b.ref
 Selenium::WebDriver::Error::UnknownError:
   Could not scroll element into view: null
 # ./test.rb:68:in `block (2 levels) in <top (required)>'

Hope this helps: 希望这可以帮助:

STEP: 步:

Given(/^I scroll down/) do
element = find_element :xpath, "//YOUR_ELEMENT_HERE']"
execute_script 'mobile: scrollTo', :element => element.ref
end

FEATURE: 特征:

Given I scroll down

You don't have to use xpath to locate element, if you have id or name it would be better choice 您不必使用xpath来定位元素,如果您具有ID或名称,则是更好的选择

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Java Appium Client在Android中滚动? - How to scroll in android using java appium client? 如何使用appium在android应用程序中滚动表单 - How to scroll form in android app using appium 如何使用appium在Android中单击ListView中的项目? - How to click item inside ListView in android using appium? 如何使用appium和java向下滚动点击Android中的元素? - How to scroll down to click the element in Android using appium and java? 如何使用Appium与Robot Framework滚动以在Android设备上测试应用程序 - How to scroll with Robot Framework using Appium to test an application at Android device 如何使用 Appium 和 Python 在 android 应用程序中滚动列表一次 - How to scroll list once in android application using Appium and Python Android + Appium:在ListView内滚动到特定位置,然后单击 - Android + Appium: Scroll inside ListView to specific position and click on it 无法使用python在带有appium的android中滚动 - Unable to scroll in android with appium using python 如何通过 Python 客户端使用 Appium 滚动 Android 应用程序 - How to scroll Android app with Appium by Python Client 如何使用Appium Java在android滚动视图中将Web元素名称添加到ArrayList中? - How to add web element names in android scroll view into an ArrayList using Appium Java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM