问题描述
我是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 settingsAppium 1.5.3Mobile platform/version under test: Android 7.1Real 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"插入所需的上限字典.那对我有用! '--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']
}
}
这篇关于每次我运行Appium,Ruby测试时如何跳过Chrome欢迎屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!