How to skip Chrome Welcome screen, every time I run Appium, Ruby test

一曲冷凌霜 提交于 2020-08-07 05:59:29

问题


I'm new to Appium. So my requirement is to run web driver test through Appium in simulator but when I run every time chrome always shows the welcome screen which I have to manually skip to see the test result and take screen shots. How to skip the chrome welcome screen?

Below is my settings Appium 1.5.3 Mobile platform/version under test: Android 7.1 Real device or emulator/simulator: Emulator

This is what I have in my env.rb file

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

回答1:


Try to insert 'chromeOptions' to your desired cap dict. That worked for me! '--disable-free' argument will disable welcome screen for your chrome browser. Check here for more details: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md

desired_cap = {
            "platformName": "Android",
            "deviceName": "AppiumP",
            'appPackage': 'com.android.chrome',
            'appActivity': 'com.google.android.apps.chrome.Main',
            'chromeOptions': {
                'args': ['--disable-fre']
            }
        }



回答2:


I was stuck at the same issue from past 3 days. You need to enable USB debugging on your simulator to get rid of the welcome screen on chrome. Follow these steps:

  1. Open settings on your simulator
  2. Tap on About emulated device
  3. Tap 7 times on the Build Number to enable Developer options
  4. Go back to the setting main page
  5. Click on Developer options
  6. Allow USB debugging

Rerun your script. You should NOT see the Welcome screen on chrome again. Good Day !!



来源:https://stackoverflow.com/questions/41843838/how-to-skip-chrome-welcome-screen-every-time-i-run-appium-ruby-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!