python+selenium 截圖儲存

aiee發表於2018-08-07
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)

相關文章