How to use get_driver_platform method in toolium

Best Python code snippet using toolium_python

driver_wrapper.py

Source:driver_wrapper.py Github

copy

Full Screen

...240 def is_mac_test(self):241 """Check if actual test must be executed in Mac desktop242 :returns: True if test must be executed in Mac desktop243 """244 return 'mac os' in self.get_driver_platform().lower()245 def is_mobile_test(self):246 """Check if actual test must be executed in a mobile247 :returns: True if test must be executed in a mobile248 """249 return self.is_android_test() or self.is_ios_test()250 def is_web_test(self):251 """Check if actual test must be executed in a browser252 :returns: True if test must be executed in a browser253 """254 appium_browser_name = self.config.get_optional('AppiumCapabilities', 'browserName')255 return not self.is_mobile_test() or appium_browser_name not in (None, '')256 def is_android_web_test(self):257 """Check if actual test must be executed in a browser of an Android mobile258 :returns: True if test must be executed in a browser of an Android mobile259 """260 return self.is_android_test() and self.is_web_test()261 def is_ios_web_test(self):262 """Check if actual test must be executed in a browser of an iOS mobile263 :returns: True if test must be executed in a browser of an iOS mobile264 """265 return self.is_ios_test() and self.is_web_test()266 def is_maximizable(self):267 """Check if the browser is maximizable268 :returns: True if the browser is maximizable269 """270 return not self.is_mobile_test()271 def should_reuse_driver(self, scope, test_passed, context=None):272 """Check if the driver should be reused273 :param scope: execution scope (function, module, class or session)274 :param test_passed: True if the test has passed275 :param context: behave context276 :returns: True if the driver should be reused277 """278 reuse_driver = self.config.getboolean_optional('Driver', 'reuse_driver')279 reuse_driver_session = self.config.getboolean_optional('Driver', 'reuse_driver_session')280 restart_driver_after_failure = (self.config.getboolean_optional('Driver', 'restart_driver_after_failure') or281 self.config.getboolean_optional('Driver', 'restart_driver_fail'))282 if context and scope == 'function':283 reuse_driver = reuse_driver or (hasattr(context, 'reuse_driver_from_tags')284 and context.reuse_driver_from_tags)285 return (((reuse_driver and scope == 'function') or (reuse_driver_session and scope != 'session'))286 and (test_passed or not restart_driver_after_failure))287 def get_driver_platform(self):288 """289 Get driver platform where tests are running290 :return: platform name291 """292 platform = ''293 if 'platform' in self.driver.desired_capabilities:294 platform = self.driver.desired_capabilities['platform']295 elif 'platformName' in self.driver.desired_capabilities:296 platform = self.driver.desired_capabilities['platformName']...

Full Screen

Full Screen

selenoid.py

Source:selenoid.py Github

copy

Full Screen

...71 if session["id"] == self.session_id:72 return True73 return False74 def download_session_video(self, scenario_name, timeout=5):75 if (self.driver_wrapper.get_driver_platform().lower() != 'linux' or76 not self.driver_wrapper.config.getboolean_optional('Capabilities', 'enableVideo')):77 return78 path_file = os.path.join(self.videos_directory, '%s.%s' % (scenario_name, constants.SEL_MP4_EXTENSION))79 if self.driver_wrapper.server_type == 'selenoid':80 filename = '%s.%s' % (self.session_id, constants.SEL_MP4_EXTENSION)81 else:82 filename = self.session_id83 video_url = f"{self.server_url}/video/{filename}"84 if self.browser_remote:85 self.__download_file(video_url, path_file, timeout)86 self.__remove_file(video_url)87 def download_session_log(self, scenario_name, timeout=5):88 if (self.driver_wrapper.get_driver_platform().lower() != 'linux' or89 not self.driver_wrapper.config.getboolean_optional('Capabilities', 'enableLog')):90 return91 path_file = os.path.join(self.logs_directory, '%s_ggr.%s' % (scenario_name, constants.SEL_LOG_EXTENSION))92 if self.driver_wrapper.server_type == 'selenoid':93 filename = '%s.%s' % (self.session_id, constants.SEL_LOG_EXTENSION)94 else:95 filename = self.session_id96 logs_url = f"{self.server_url}/logs/{filename}"97 if self.browser_remote:98 self.__download_file(logs_url, path_file, timeout)99 self.__remove_file(logs_url)100 def download_file(self, filename, timeout=5):101 path_file = os.path.join(self.output_directory, constants.SEL_DOWNLOADS_PATH, self.session_id[-8:], filename)102 file_url = f"{self.server_url}/download/{self.session_id}/{filename}"...

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 toolium 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