我需要对模拟器中的警告框进行截图。我只是得到背景图像,而不是弹出窗口/警告框。
我不知道如何设置这个 SCREENSHOT_VIA_USB=true 。
有人可以帮我吗?
最佳答案
if ENV["SCREENSHOT_VIA_USB"] == "true"
device_args = "-s #{@serial}" if @serial
screenshot_cmd = "java -jar #{File.join(File.dirname(__FILE__), 'lib', 'screenShotTaker.jar')} #{path} #{device_args}"
log screenshot_cmd
raise "Could not take screenshot" unless system(screenshot_cmd)
else
begin
res = http("/screenshot")
rescue EOFError
raise "Could not take screenshot. App is most likely not running anymore."
end
File.open(path, 'wb') do |f|
f.write res
end
end
SCREENSHOT_VIA_USB 是一个环境变量,尝试:
export SCREENSHOT_VIA_USB=true
关于android - 如何在 calabash android 中设置 SCRENSHOT_VIA_USB=true 。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15045675/