How to use _get_capabilities_from_driver_type method in toolium

Best Python code snippet using toolium_python

config_driver.py

Source:config_driver.py Github

copy

Full Screen

...61 # Get server url62 server_url = '{}/wd/hub'.format(self.utils.get_server_url())63 # Get driver capabilities64 driver_name = self.utils.get_driver_name()65 capabilities = self._get_capabilities_from_driver_type(driver_name)66 # Add version and platform capabilities67 self._add_capabilities_from_driver_type(capabilities)68 if driver_name == 'opera':69 capabilities['opera.autostart'] = True70 capabilities['opera.arguments'] = '-fullscreen'71 elif driver_name == 'firefox':72 capabilities['firefox_profile'] = self._create_firefox_profile().encoded73 # Add custom driver capabilities74 self._add_capabilities_from_properties(capabilities, 'Capabilities')75 if driver_name == 'chrome':76 self._add_chrome_options_to_capabilities(capabilities)77 if driver_name in ('android', 'ios', 'iphone'):78 # Create remote appium driver79 self._add_capabilities_from_properties(capabilities, 'AppiumCapabilities')80 return appiumdriver.Remote(command_executor=server_url, desired_capabilities=capabilities)81 else:82 # Create remote web driver83 return webdriver.Remote(command_executor=server_url, desired_capabilities=capabilities)84 def _create_local_driver(self):85 """Create a driver in local machine86 :returns: a new local selenium driver87 """88 driver_name = self.utils.get_driver_name()89 if driver_name in ('android', 'ios', 'iphone'):90 # Create local appium driver91 driver = self._setup_appium()92 else:93 driver_setup = {94 'firefox': self._setup_firefox,95 'chrome': self._setup_chrome,96 'safari': self._setup_safari,97 'opera': self._setup_opera,98 'iexplore': self._setup_explorer,99 'edge': self._setup_edge,100 'phantomjs': self._setup_phantomjs101 }102 try:103 driver_setup_method = driver_setup[driver_name]104 except KeyError:105 raise Exception('Unknown driver {0}'.format(driver_name))106 # Get driver capabilities107 capabilities = self._get_capabilities_from_driver_type(driver_name)108 self._add_capabilities_from_properties(capabilities, 'Capabilities')109 # Create local selenium driver110 driver = driver_setup_method(capabilities)111 return driver112 @staticmethod113 def _get_capabilities_from_driver_type(driver_name):114 """Create initial driver capabilities115 :params driver_name: name of selected driver116 :returns: capabilities dictionary117 """118 if driver_name == 'firefox':119 capabilities = DesiredCapabilities.FIREFOX.copy()120 elif driver_name == 'chrome':121 capabilities = DesiredCapabilities.CHROME.copy()122 elif driver_name == 'safari':123 capabilities = DesiredCapabilities.SAFARI.copy()124 elif driver_name == 'opera':125 capabilities = DesiredCapabilities.OPERA.copy()126 elif driver_name == 'iexplore':127 capabilities = DesiredCapabilities.INTERNETEXPLORER.copy()...

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