CALABASH-不使用迭代器重命名屏幕快照文件名 [英] CALABASH - Renaming screenshot filenames without the iterator

查看:78
本文介绍了CALABASH-不使用迭代器重命名屏幕快照文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Calabash中,您可以截取屏幕截图并将其重命名为所需名称,然后将其保存到任何目录中,如下所示:

In Calabash you can take a screenshot and rename it to whatever you want and save it to any directory like so:

screenshot({:prefix => "some/directory", :name=>"some_name.png"})

但是它将始终另存为 some_name_0.png ,下一个将是 some_name_1.png

However it will always save as some_name_0.png and the next one will be some_name_1.png.

有人知道如何在没有迭代器的情况下完全重命名文件名吗?

Does anyone know how to rename the filename completely without the iterator?

推荐答案

您还可以仅从步骤中传递有关将屏幕转储另存为内容的文本。
我这样做是为了轻松设置前缀和名称,并且仅在将 capture = true添加到启动命令时才进行屏幕转储。

You can also just pass text from your steps on what to save the screendump as. I have done this to easily set the prefix and name and only take the screendumps when I add "capture=true" to the start command.

def take_picture(prefix, name)
  if ENV["capture"] == 'true'
    screenshot(options={:prefix=>prefix, :name=>name})
  end
end

像这样(此示例未添加特殊前缀:

And from the steps I call it like this(this is example does not add special prefix:

take_picture("","SettingsMenu1")

这篇关于CALABASH-不使用迭代器重命名屏幕快照文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆