51Testing软件测试论坛

标题: 现在携程网登陆有个滑动的验证码的 [打印本页]

作者: 磊二爷i    时间: 2019-1-30 11:25
标题: 现在携程网登陆有个滑动的验证码的
老师你好:
后面会说验证码怎么处理吗 ,现在携程网登陆有个滑动的验证码的


在学课程:
Python Selenium3项目实战
http://www.atstudy.com/course/1005


作者: 学掌门网校    时间: 2019-1-30 11:52
参考以下代码:

from selenium import webdriver
from selenium.webdriver.support.select import  Select
path= 'C:/Program Files (x86)/Google/Chrome/chromedriver.exe'
from selenium.webdriver.common.action_chains import ActionChains
import  time
driver = webdriver.Chrome(path)
driver.get("https://passport.ctrip.com/user/reg/home")
driver.find_element_by_css_selector("#agr_pop > div.pop_footer > a.reg_btn.reg_agree").click()
time.sleep(3)
sour=driver.find_element_by_css_selector("#slideCode > div.cpt-drop-box > div.cpt-drop-btn")
print( sour.size['width'])
print(sour.size["height"])
ele=driver.find_element_by_css_selector("#slideCode > div.cpt-drop-box > div.cpt-bg-bar")
print( ele.size['width'])
print(ele.size["height"])
ActionChains(driver).drag_and_drop_by_offset(sour,ele.size['width'],-sour.size["height"]).perform()




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2