# 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')
个人简介
我是一名测试兼开发工程师,目前25K,目前做的是无人驾驶,欢迎和大家一起交流测试技术,
起高薪就业,我们还有一起打妖怪的群哦,还有面试题小程序哦
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)