[英]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.