滑动处理
#点击元素拖动 def click_move(by,locator,value): try: source = get_element(driver,by,locator) # 需要滑动的元素 action = ActionChains(driver) action.click_and_hold(source).perform() # 鼠标左键按下不放 action.reset_actions() # 清除之前的action distance = value #滑动距离 track = get_track(distance) #循环执行 for i in track: action.move_by_offset(xoffset=i, yoffset=0).perform() action.reset_actions() sleep(1) action.release().perform() # 释放鼠标 sleep(1) except Exception as e: print(e)
心之所向无人可挡