如何跳过 Chrome 欢迎屏幕,每次运行 Appium 时,Ruby 测试 [英] How to skip Chrome Welcome screen, every time I run Appium, Ruby test
问题描述
我是 Appium 的新手.所以我的要求是在模拟器中通过 Appium 运行 Web 驱动程序测试,但是当我每次运行时 chrome 总是显示欢迎屏幕,我必须手动跳过该屏幕才能查看测试结果并截取屏幕截图.如何跳过 chrome 欢迎屏幕?
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?
以下是我的设置Appium 1.5.3被测移动平台/版本:Android 7.1真机或模拟器/模拟器:模拟器
Below is my settings Appium 1.5.3 Mobile platform/version under test: Android 7.1 Real device or emulator/simulator: Emulator
这是我的 env.rb 文件
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
推荐答案
尝试将 'chromeOptions' 插入到您想要的 cap dict 中.那对我有用!'--disable-free' 参数将禁用 Chrome 浏览器的欢迎屏幕.在此处查看更多详细信息:https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md
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']
}
}
这篇关于如何跳过 Chrome 欢迎屏幕,每次运行 Appium 时,Ruby 测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!