如何跳过 Chrome 欢迎屏幕,每次运行 Appium 时,Ruby 测试

Ram*_*Ram 5 ruby android appium

我是 Appium 的新手。所以我的要求是在模拟器中通过 Appium 运行 Web 驱动程序测试,但是当我每次运行时 chrome 总是显示欢迎屏幕,我必须手动跳过该屏幕才能查看测试结果并截取屏幕截图。如何跳过chrome欢迎屏幕?

下面是我的设置 Appium 1.5.3 Mobile platform/version under test: Android 7.1 Real device or emulator/simulator: Emulator

这是我的 env.rb 文件中的内容

begin
  system 'adb uninstall io.appium.settings'
  system 'adb uninstall io.appium.unlock'
  $driver = Appium::Driver.new(desired_caps).start_driver
rescue Exception => e
  puts e.message
  Process.exit(0)  
 end
else # else create driver instance for desktop browser
 begin
   $driver = Selenium::WebDriver.for(:"#{$browser_type}")
   $driver.manage().window().maximize()
 rescue Exception => e
   puts e.message
   Process.exit(0)
 end
end
Run Code Online (Sandbox Code Playgroud)

小智 -1

过去三天我一直遇到同样的问题。您需要在模拟器上启用 USB 调试才能摆脱 chrome 上的欢迎屏幕。按着这些次序:

  1. 打开模拟器上的设置
  2. 点击关于模拟设备
  3. 点击版本号 7 次以启用开发者选项
  4. 返回设置主页面
  5. 点击开发者选项
  6. 允许USB调试

重新运行您的脚本。您不应该再在 Chrome 上看到欢迎屏幕。再会 !!