iOS 测试 APP 内 webview 页面上下滑动没有效果,代码如下,求大神指点

Aya · 2016年11月22日 · 最后由 旧时光 回复于 2018年12月07日 · 1510 次阅读

代码如下:
我是想有上滑的操作,所以从屏幕的 3/4 位置向屏幕 1/4 位置上滑,但是发现它是下滑,将两个坐标互换还是下滑的操作,新人求指点

self.driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]').click()
width = self.driver.get_window_size()['width']
height = self.driver.get_window_size()['height']
 #self.driver.swipe(start_x=width / 2, start_y=50, end_x=width / 2, end_y=500, duration=1000)
elWebView = self.driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAWebView[1]')
act.press(None, width / 2, height * 3 / 4).move_to(None, width / 2, height/4).release().perform()
sleep(10)
共收到 3 条回复 时间 点赞

swipe(self, start_x, start_y, end_x, end_y, duration=None),不行么?

Aya #2 · 2016年11月23日 Author

#1 楼 @tongshanshanshan 也不行,我是在 APP 里打开了一个 h5 页面,跟这个有关系么

public void swipeToUp(long during) {
int width = getWidth();
int height = getHeight();
// driver.swipe(width / 2, height * 3 / 4, width / 2, height / 4, during);
TouchAction touchAction = new TouchAction(driver);
touchAction.press(PointOption.point(width / 2, height * 3 / 4))
.waitAction(WaitOptions.waitOptions(Duration.ofMillis(during)))
.moveTo(PointOption.point(width / 2, height / 4)).release().perform();
logger.info("向上滑动");
}
向上滑动封装

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册