'Appium on IOS - switch between NATIVE_APP and SAFARI

  1. I need to do some activity in the native_app
  2. I need to switch to the Safari and do some activity there
  3. I need to switch back to the native_app and do some activity there

I tried to use bundleId in the capabilities, but in this case I can't open any webpage in Safari. To solve it I need to use browserName in the capabilities, but Appium doesn't allow to use bundleId and browserName in same capabilities. In case of use only browserName - the native app is not responsible.

Then I decide to create two sessions and use two drivers on different ports at the same time. Drivers init passed successfully, but I can't do some activity due to error: Original error: Could not proxy command to the remote server. Original error: socket hang up.

capabilities_1 = {
        'platformName': 'iOS',
        'deviceName': 'iPhone XS',
        'automationName': 'XCuiTest',
        'udid': 'auto',
        'bundleId': 'xxxxxxxxxx',
        'xcodeOrgId': '0000000000',
        'xcodeSigningId': 'iPhone Developer',
        'updatedWDABundleId': 'xxxxxxxxxxxxxxx',
        'wdaLocalPort': '8101'
    }
    url = 'http://localhost:4723/wd/hub'

    appium_driver = webdriver.Remote(url, capabilities_1)


capabilities_2 = {
        'platformName': 'iOS',
        'deviceName': 'iPhone XS',
        'automationName': 'XCuiTest',
        'udid': 'auto',
        'browserName': 'safari',
        'xcodeOrgId': '0000000000',
        'xcodeSigningId': 'iPhone Developer',
        'updatedWDABundleId': 'xxxxxxxxxxxxxxx',
        'wdaLocalPort': '8102',
    }
    url_web = 'http://localhost:4726/wd/hub'

    appium_driver_web = webdriver.Remote(url_web, capabilities_2)

Could everybody provides me with solution?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source