from PIL import Image from selenium import webdriver aa=webdriver.Chrome() aa.get('图片utl') element=aa.find_element_by_xpath('//img') # 指定元素图片区域 aa.save_screenshot('111.png') print(element.location) 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('111.png') im=im.crop((left,top,right,bottom)) im.save('111.png')
selenium 区域截图
最新推荐文章于 2024-04-30 14:32:26 发布