问题
I could not get swipe left to work to go from view to view. so I am now trying to use the pagination dot at the bottom of the screen to change the view.
Can someone please tell me how i can touch dot 'n' using calabash?
I am going to go back to the code and try to see if I can set a accessibility label to the dot. But would love it if there was some way that someone out there in the wide world has already solved this.
i used the following code:
Then /^I swipe left on the cell with name "([^\"]*)"$/ do |arg|
swipe :left, :query => "view marked:'#{arg}'",force: :strongs
end
THIS passes, but it does not actually swipe.
edit:
from what i noticed, the dot was drawn and is not an object, but i could be mistaken. so i could not give it a label. i am still trying to use swipe to change the page-
swipe :left, :query => "view marked:'#{arg}'", :offset => {:x => 0, :y => 0}, :"swipe-delta" => {:horizontal => {:dx=> 1000, :dy=>0} },force: :strong
回答1:
What happens when you user the default swipe left? Does it swipe a little but not make it to the next page? We've found that the default swipes are too small to actually switch page views, and defined custom ones, which looks to be what you did above. What do you mean it doesn't actually swipe? Check out this page for more info on swiping.
Setting an accessibility is definitely going to be the best way to press the "dot" but if you can find a unique class structure you could also use that:
touch("CellScrollView child * child UIImage")
I don't recommend this route though, will make your code more sensitive to UI changes. Just add the accessibility label.
回答2:
thank you astray for your help and guidance. the solution that worked for me was this:
Then I swipe to the right
with the definition:
Then /^I swipe to the (left|right|up|down)$/ do |direction|
scroll("scrollView marked:'SCROLL VIEW'", direction)
sleep(STEP_PAUSE) # optional
end
I will be making this more dynamic, but thought i might as well post the answer here and close the question. also, i would also like to say that though we are 'swiping' left, as we have to move to the page or object on the right, we have to swipe right to move to the object on the right.
来源:https://stackoverflow.com/questions/29844065/how-to-swipe-from-page-to-page-on-an-ios-pagination-view-using-calabash