本文只针对横向由左向右滑动的验证码
目标网站为https://login.aliexpress.com/seller.htm(速卖通-阿里巴巴国际站)
def sliding_verification(chrome):
# 获取拖拽的滑动验证码块
# 按钮xpath
time.sleep(2)
slideblock = chrome.find_element_by_xpath('//*[@id="nc_1_n1z"]')
# 鼠标点击滑动块不松开
time.sleep(1)
ActionChains(chrome).click_and_hold(slideblock).perform()
# 将圆球滑至相对起点位置的 右边xx
for i in range(4):
ActionChains(chrome).move_by_offset(xoffset=70, yoffset=0).perform()
time.sleep(1)
time.sleep(1)
# 放开滑动块
ActionChains(chrome).release(slideblock).perform()
time.slee