python+selenium 截图保存

import os
import time


class ScreenShot(object):
    def screenshot(self):
        rq = time.strftime('%Y%m%d%H%M', time.localtime(time.time()))
        pic_path = os.path.dirname(os.getcwd()) + '/screenshots/'
        pic_name = pic_path + rq + '.png'
        self.driver.save_screenshot(pic_name)

猜你喜欢

转载自blog.csdn.net/sinat_34209942/article/details/81481408