🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
可以参考之前写过的这篇:[https://www.cnblogs.com/yoyoketang/p/7748693.html](https://www.cnblogs.com/yoyoketang/p/7748693.html) ~~~ # coding:utf-8 from selenium import webdriver from PIL import Image driver = webdriver.Chrome() driver.get('http://www.baidu.com/') driver.save_screenshot('button.png') element = driver.find_element_by_id("su") 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('button.png') im = im.crop((left, top, right, bottom)) im.save('button.png') ~~~