问题
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:
- Open settings on your simulator
- Tap on About emulated device
- Tap 7 times on the Build Number to enable Developer options
- Go back to the setting main page
- Click on Developer options
- 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