如何使用 ruby capybara 框架启动 Android 的 appium 驱动程序
def register_cloud_mobile_driver
Capybara.register_driver :cloud_mobile do |app|
opts = Selenium::WebDriver::Remote::Capabilities.firefox(
securityToken: @sec_token,
platformVersion: 'xx',
platformBuild: 'xxxxx',
manufacturer: 'xxx',
model: 'Galaxy S22',
resolution: '1080x2340',
deviceStatus: 'CONNECTED',
location: 'xxxx',
appPackage: 'xxxxx',
appActivity: 'xxxxx.activity.SplashActivityV2',
takesScreenshot: false,
screenshotOnError: true
)
Capybara::Selenium::Driver.new(app, browser: :remote, url: $server_url, desired_capabilities: opts)
Capybara.default_driver = cloud_mobile
end
end
结果:
"undefined method `testExecutionTags' for nil:NilClass
"WARN: Screenshot could not be saved. `page.current_path` raised exception:
#<ArgumentError: rack-test requires a rack application, but none was given>.
尝试使用appium_capybara gem。它在 capybara 中启用了 appium 支持 https://github.com/appium/appium_capybara