Swipe method not working in android automation testing -
i trying implement swipe method.may know correct way achieve objective?
public void swipewithcordinatelocation(webdriver driver,double startx, double starty,double endx,double endy, double duration) { javascriptexecutor js = (javascriptexecutor) driver; hashmap<string, double> swipeobject = new hashmap<string, double>(); swipeobject.put("x", startx); swipeobject.put("y", starty); swipeobject.put("x", endx); swipeobject.put("y",endy ); swipeobject.put("duration", duration); // hashmap[] param = {swipeobject}; js.executescript("mobile: swipe", swipeobject); } common.swipewithcordinatelocation(driver, 100.00, 500.00, 500.00, 500.00, 1.00);
but appium perform swipe takes different credentials
[x=360][y=592] [x=360][y=592]
. do? can 1 me please.
the best way analyze swipe in automation enable "show touches" , "pointer location" options in developer option.
the correct code swipe parameters -
swipeobject.put("startx", 198.00); swipeobject.put("starty", 685.00); swipeobject.put("endx", 198.00); swipeobject.put("endy", 550.00); swipeobject.put("duration", 1.0);
hope helps.
or better way use using fractions -
swipeobject.put("startx", 0.50); swipeobject.put("starty", 0.50); swipeobject.put("endx", 0.50); swipeobject.put("endy", 0.35); swipeobject.put("duration", 1.0);
Comments
Post a Comment