标签:oca ott imp color xpath 本地 pil pen col
# 截取验证码图片 from PIL import Image driver.save_screenshot(‘bdbutton.png‘) element = driver.find_element_by_xpath(‘//*[@id="nc_1_clickCaptcha"]/div[2]/img‘) #找到验证码图片 print(element.location) # 打印元素坐标 print(element.size) # 打印元素大小 left = element.location[‘x‘] top = element.location[‘y‘] right = element.location[‘x‘] + element.size[‘width‘] bottom = element.location[‘y‘] + element.size[‘height‘] im = Image.open(‘bdbutton.png‘) im = im.crop((left, top, right, bottom)) im.save(‘bdbutton.png‘) # 将得到的图片保存在本地
标签:oca ott imp color xpath 本地 pil pen col
原文地址:https://www.cnblogs.com/gaoyukun/p/9719615.html