4

由于我在一个与许多应用程序(而不是单个目标应用程序)一起工作的平台上工作,我发现目标应用程序的选择对我的需求来说效率低下。我想知道我是否可以做些什么来避免它。

我想自由运行,向 iOS 和 Android 真机发送 UI 命令,包括从另一个应用程序(如 Play Store、Apple Store、Test Flight 等)安装一个应用程序

谢谢您的帮助,

大卫。

4

1 回答 1

2

The rule is: 1 Webdriver instance per application.

You can run Appium's server with no --app argument by making sure auto-launch is set to false, and not setting bundleId or app.

Then, in your client/test framework, you use several webdrivers, configured to use different desired capabilities, to tie it all together under a single test case/suite.

The solution:

  • You may have a test suite that sets desired_capabilities to launch the Safari app, then you install the app, then you quit the webdriver.

  • Then you change the desired_capabilities to point to the bundle_id of the new app, launch another webdriver instance, do your tests, quit the webdriver..

  • Then you change the desired_capabilities to point to (etc., etc.)

    driver = webdriver.new(url, desired_capabilities)
    // do some stuff
    driver.quit()
    
    desired_capabilities['app'] = 'company.app.com'
    driver = webdriver.new(url, desired_capabilities)
    // do some stuff
    driver.quit()
    
    desired_capabilities['app'] = '/path/to/application.app'
    driver = webdriver.new(url, desired_capabilities)
    // do some stuff
    driver.quit()
    
于 2014-07-09T19:02:13.173 回答