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

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)

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

 

 

 

 

 

posted @ 2018-01-08 14:22  每一天,为明天。  阅读(153)  评论(0)    收藏  举报