python+selenium滑动式验证码解决办法

时间:2023-03-08 20:47:05
from selenium.webdriver import ActionChains

action = ActionChains(driver)

source=driver.find_element_by_xpath("//*[@id='nc_1_n1t']/span")#需要滑动的元素
action.click_and_hold(source).perform()  #鼠标左键按下不放
action.move_by_offset(298,0)#需要滑动的坐标
action.release().perform() #释放鼠标 time.sleep(1)

python+selenium滑动式验证码解决办法

但以上方法在某些网站有反机器机制不能正常进入,类似下面这种情况(当你滑动完了它还是有意见<-_->)

python+selenium滑动式验证码解决办法