webdriver保存验证码截图

element = wait.until ( EC.visibility_of_element_located((By.CSS_SELECTOR,'.quc-main .quc-field-captcha img')))  #等待验证码加载完毕element


browser.save_screenshot('screenshot.png')it


left = element.location['x']
top = element.location['y']
right = element.location['x'] + element.size['width']
bottom = element.location['y'] + element.size['height']io


im = Image.open('screenshot.png')
im = im.crop((left,top,right,bottom))
im.save('screenshot.png')验证码

相关文章
相关标签/搜索