WebDriverio-无法动态传递输出目录

发布于 2025-02-10 20:02:54 字数 778 浏览 0 评论 0原文

以下是我的Onprepare&记者。当我在记者中访问result_path时,我的价值为未定义。

onPrepare: function (config, capabilities) {
        today = new Date()
        date = today.getDate()
        time = date + "_" + today.getHours() + "hrs_" + today.getMinutes() + "mins_" + today.getSeconds() + "secs"
        result_path = './execution_time_'+ time
        
        if (!fs.existsSync(result_path)) {
            fs.mkdirSync(result_path);
        }
        
    },
    reporters: [['timeline', {
        outputDir: result_path+'/',
         fileName: 'timeliner-reporter.html',
         embedImages: true,
         images: {
             quality: 80,
             resize: false,
             reductionRation: 2
         },
         screenshotStrategy:'before:click'
     }]],

Below is my onprepare & reporters. When I access result_path in reporters I got value as undefined.

onPrepare: function (config, capabilities) {
        today = new Date()
        date = today.getDate()
        time = date + "_" + today.getHours() + "hrs_" + today.getMinutes() + "mins_" + today.getSeconds() + "secs"
        result_path = './execution_time_'+ time
        
        if (!fs.existsSync(result_path)) {
            fs.mkdirSync(result_path);
        }
        
    },
    reporters: [['timeline', {
        outputDir: result_path+'/',
         fileName: 'timeliner-reporter.html',
         embedImages: true,
         images: {
             quality: 80,
             resize: false,
             reductionRation: 2
         },
         screenshotStrategy:'before:click'
     }]],

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文