How to use _get_platform method in robotframework-appiumlibrary

Best Python code snippet using robotframework-appiumlibrary_python

utils.py

Source:utils.py Github

copy

Full Screen

...12 def __init__(self):13 self._platform_ios = None14 self._platform_android = None15 def __eq__(self, other):16 return other == self._get_platform()17 def __ne__(self, other):18 return other != self._get_platform()19 def __str__(self):20 return self._get_platform()21 def __repr__(self):22 return 'platform name: \'{platform}\' from: \n{instance}'.format(23 platform=self._get_platform(),24 instance=super(Platform, self).__repr__()25 )26 def __hash__(self):27 return self._get_platform().__hash__()28 def _get_platform(self):29 if self._platform_android is None:30 # ANDROID_ARGUMENT and ANDROID_PRIVATE are 2 environment variables31 # from python-for-android project32 self._platform_android = 'ANDROID_ARGUMENT' in environ33 if self._platform_ios is None:34 self._platform_ios = (environ.get('KIVY_BUILD', '') == 'ios')35 # On android, _sys_platform return 'linux2', so prefer to check the36 # import of Android module than trying to rely on _sys_platform.37 if self._platform_android is True:38 return 'android'39 elif self._platform_ios is True:40 return 'ios'41 elif _sys_platform in ('win32', 'cygwin'):42 return 'win'...

Full Screen

Full Screen

platform.py

Source:platform.py Github

copy

Full Screen

...17class Platform(object):18 _platform_android = None19 _platform_ios = None20 def __eq__(self, other):21 return other == self._get_platform()22 def __ne__(self, other):23 return other != self._get_platform()24 def __str__(self):25 return self._get_platform().name26 def __repr__(self):27 return '<platform name: \'{platform}\' from: \n{instance}>'.format(28 platform=self._get_platform(),29 instance=super(Platform, self).__repr__()30 )31 def __hash__(self):32 return self._get_platform().__hash__()33 def _get_platform(self):34 if self._platform_android is None:35 # ANDROID_ARGUMENT and ANDROID_PRIVATE are 2 environment variables36 # from python-for-android project37 self._platform_android = 'ANDROID_ARGUMENT' in os.environ38 if self._platform_ios is None:39 self._platform_ios = 'IOS_ARGUMENT' in os.environ40 # On android, sys.platform return 'linux2', so prefer to check the41 # import of Android module than trying to rely on sys.platform.42 if self._platform_android is True:43 return Platforms.android44 if self._platform_ios is True:45 return Platforms.ios46 if sys.platform in ('win32', 'cygwin'):47 return Platforms.windows48 if sys.platform == 'darwin':49 return Platforms.macosx50 if sys.platform[:5] == 'linux':51 return Platforms.linux52 return Platforms.unknown53 @property54 def name(self):55 platform = self._get_platform()56 if platform == Platforms.linux:57 return '-'.join(_platform.linux_distribution()[:2])58 if platform == Platforms.macosx:59 return '-'.join(['MacOS', _platform.mac_ver()[0], _platform.mac_ver()[-1]])60 if platform == Platforms.windows:61 return '-'.join(['Windows', _platform.win32_ver()[0]])62 return Platforms.unknown.name63 def is_64bit():64 """Checks, if the platform is a 64-bit machine."""65 is64bit = sys.maxsize > 2 ** 3266 if sys.platform == "cli":67 is64bit = sys.executable.endswith("ipy64.exe")68 return is64bit69platform = Platform()

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run robotframework-appiumlibrary automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful