android - 如何在 calabash android 中设置 SCRENSHOT_VIA_USB=true 。

标签 android calabash

我需要对模拟器中的警告框进行截图。我只是得到背景图像,而不是弹出窗口/警告框。

我不知道如何设置这个 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/

相关文章:

android - JNI 在应用程序中检测到错误 : JNI NewGlobalRef called with pending exception java. lang.ClassNotFoundException:

android - 实例化后是否可以更改 WebView 的上下文?

android - 使用 YouTube Android Player API 时,YouTube 广告从不显示

android - 葫芦-android : `Cucumber::Ast` no longer exists

Xamarin "xcodebuild output not as expected"

ruby - 如何避免 Errno::ECONNREFUSED: (连接被拒绝 - connect(2)

ListView 内的 Android WebView

android - 如何在没有 AccountManager 或权限的情况下在 EditText 上显示用户电子邮件

java - 如何在 Windows 8 中安装 calabash for android?

appium - Mobile Center CLI, "SyntaxError: Unexpected token"上传测试时