Python 利用Webdriver进行UI测试页面截图

#!/user/bin/python3
# coding:utf-8


import time

def screenshot(self):
    current_time = time.strftime("IMG_%Y%m%d%H%M%S", time.localtime(time.time()))
    print(current_time)
    pic_path = 'C:/Users/foresee/.PyCharm2017.3/Test_UI/image/' + '/' + current_time + '.png'
    print('保存截图路径为:', pic_path)
    self.driver.get_screenshot_as_file(pic_path)

猜你喜欢

转载自blog.csdn.net/weixin_42116406/article/details/83827377
今日推荐