一鹦倚、滾動操作:scroll
1、含義理解:滾動頁面冀惭,與坐標(biāo)無關(guān)系
image.png
3、實(shí)際代碼演示:
# 垂直滾動到頁面頂部/橫向滾動到最左側(cè)
d(scrollable=True).scroll.toBeginning()
d(scrollable=True).scroll.horiz.toBeginning()
# 垂直滾動到頁面最底部/橫向滾動到最右側(cè)
d(scrollable=True).scroll.toEnd()
d(scrollable=True).scroll.horiz.toEnd()
# 垂直向后滾動到指定位置/橫向向右滾動到指定位置
d(scrollable=True).scroll.to(description="指定位置")
d(scrollable=True).scroll.horiz.to(description="指定位置")
# 垂直向前滾動(橫向同理)
d(scrollable=True).scroll.forward()
# 垂直向前滾動到指定位置(橫向同理)
d(scrollable=True).scroll.forward.to(description="指定位置")
4云头、注意事項(xiàng):其他頁面滾動的情況請看源碼示例捐友,可以隨意組合,一般情況下都能滾動到自己想要的頁面位置溃槐;如果scroll不能滾動到自己想要的位置匣砖,請使用swipe方法,如下所示
二昏滴、滑動操作:swipe
1猴鲫、含義理解:從A點(diǎn)滑動到B點(diǎn),可以理解為滑動屏幕
2谣殊、源碼示例:
image.png
3拂共、實(shí)際代碼演示:
# 從sx,sy坐標(biāo)滑動至ex姻几,ey坐標(biāo)
d.swipe(sx, sy, ex, ey)
三宜狐、拖拽操作:drag
1、含義理解:把A拖拽到B的位置蛇捌,可以理解為拖拽按鈕抚恒,與swipe類似
2、源碼示例:
image.png
3络拌、實(shí)際代碼演示:
# 從sx俭驮,sy坐標(biāo)拖拽至ex,ey坐標(biāo)
d.drag(sx, sy, ex, ey)