Reputation: 360
I don't know how to get desired capabilities I've set with Appium Python client.
What I need specifically to know is which platform is set, is it iOS or Android?
I have Appium driver like this.
self.driver = webdriver.Remote(config['server_url'], config['device_config'])
server_url = http://localhost:4723/wd/hub
device_config = samsung_galaxy_nexus_6_0
'samsung_galaxy_nexus_6_0': {
'app': '/Users/majdukovic/Documents/no_root_ux.apk',
'platformName': 'Android',
'platformVersion': '6.0',
'deviceName': 'Galaxy Nexus 6.0',
'avd': 'Galaxy_Nexus_6.0',
I need something like this
self.driver.get_capabilities('platformName')
Thanks.
Upvotes: 1
Views: 7129
Reputation: 360
Already set capabilities can be accessed with self.driver.desired_capabilities['capabilty_name_here']
for example:
self.driver.desired_capabilities['platformName']
self.driver.desired_capabilities['deviceName']
etc.
Upvotes: 2
Reputation: 301
You can either use Android environment or iOS environment
# Android environment
import unittest
from appium import webdriver
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.2'
desired_caps['deviceName'] = 'Android Emulator'
desired_caps['app'] = PATH('../../../apps/selendroid-test-app.apk')
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
# iOS environment
import unittest
from appium import webdriver
desired_caps = {}
desired_caps['platformName'] = 'iOS'
desired_caps['platformVersion'] = '7.1'
desired_caps['deviceName'] = 'iPhone Simulator'
desired_caps['app'] = PATH('../../apps/UICatalog.app.zip')
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
Source: https://github.com/appium/python-client
If it doesn't help what you need then simply comment below.
Upvotes: 1