本文整理汇总了Python中toolium.driver_wrappers_pool.DriverWrappersPool类的典型用法代码示例。如果您正苦于以下问题:Python DriverWrappersPool类的具体用法?Python DriverWrappersPool怎么用?Python DriverWrappersPool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DriverWrappersPool类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: configure_logger
def configure_logger(self, tc_config_log_filename=None, tc_output_log_filename=None):
"""Configure selenium instance logger
:param tc_config_log_filename: test case specific logging config file
:param tc_output_log_filename: test case specific output logger file
"""
# Get config logger filename
config_log_filename = DriverWrappersPool.get_configured_value('Config_log_filename', tc_config_log_filename,
'logging.conf')
config_log_filename = os.path.join(DriverWrappersPool.config_directory, config_log_filename)
# Configure logger only if logging filename has changed
if self.config_log_filename != config_log_filename:
# Get output logger filename
output_log_filename = DriverWrappersPool.get_configured_value('Output_log_filename', tc_output_log_filename,
'toolium.log')
output_log_filename = os.path.join(DriverWrappersPool.output_directory, output_log_filename)
output_log_filename = output_log_filename.replace('\\', '\\\\')
try:
logging.config.fileConfig(config_log_filename, {'logfilename': output_log_filename}, False)
except Exception as exc:
print("[WARN] Error reading logging config file '{}': {}".format(config_log_filename, exc))
self.config_log_filename = config_log_filename
self.output_log_filename = output_log_filename
self.logger = logging.getLogger(__name__)
开发者ID:jframos,项目名称:toolium,代码行数:26,代码来源:driver_wrapper.py
示例2: tearDown
def tearDown(self):
# Call BasicTestCase tearDown
super(SeleniumTestCase, self).tearDown()
# Close drivers
DriverWrappersPool.close_drivers(scope='function',
test_name=self.get_subclassmethod_name(),
test_passed=self._test_passed)
开发者ID:jframos,项目名称:toolium,代码行数:7,代码来源:test_cases.py
示例3: tearDownClass
def tearDownClass(cls):
# Call BasicTestCase tearDownClass
super(SeleniumTestCase, cls).tearDownClass()
# Close browser and stop driver if it has been reused
DriverWrappersPool.close_drivers_and_download_videos(cls.get_subclass_name())
SeleniumTestCase.driver = None
开发者ID:ivanprjcts,项目名称:toolium,代码行数:7,代码来源:test_cases.py
示例4: setUp
def setUp(self):
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
if not self.driver_wrapper.driver and not self.config_files.config_directory:
# By default config directory is located in test path
self.config_files.set_config_directory(DriverWrappersPool.get_default_config_directory())
super(AppiumTestCase, self).setUp()
AppiumTestCase.app_strings = self.driver_wrapper.app_strings
开发者ID:jframos,项目名称:toolium,代码行数:8,代码来源:test_cases.py
示例5: driver_wrapper
def driver_wrapper():
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
driver_wrapper = DriverWrappersPool.get_default_wrapper()
driver_wrapper.driver = mock.MagicMock()
return driver_wrapper
开发者ID:Telefonica,项目名称:toolium,代码行数:10,代码来源:test_page_elements.py
示例6: setUp
def setUp(self):
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
# Create default wrapper
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
# Configure properties
config_files = ConfigFiles()
root_path = os.path.dirname(os.path.realpath(__file__))
config_files.set_config_directory(os.path.join(root_path, 'conf'))
config_files.set_output_directory(os.path.join(root_path, 'output'))
self.driver_wrapper.configure(tc_config_files=config_files)
开发者ID:cesarca,项目名称:toolium,代码行数:13,代码来源:test_driver_wrappers_pool.py
示例7: setUp
def setUp(self):
# Configure logger and properties
if not isinstance(self, SeleniumTestCase):
# By default config directory is located in test path
if not self.config_files.config_directory:
self.config_files.set_config_directory(DriverWrappersPool.get_default_config_directory())
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
self.driver_wrapper.configure(False, self.config_files)
# Get config and logger instances
self.config = self.driver_wrapper.config
self.logger = logging.getLogger(__name__)
self.logger.info("Running new test: {0}".format(self.get_subclassmethod_name()))
开发者ID:rgonalo,项目名称:toolium,代码行数:13,代码来源:test_cases.py
示例8: setUp
def setUp(self):
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
config_files = ConfigFiles()
config_files.set_config_directory(os.path.join(self.root_path, 'conf'))
config_files.set_output_directory(os.path.join(self.root_path, 'output'))
DriverWrappersPool.configure_common_directories(config_files)
self.driver_wrapper.configure_properties()
开发者ID:cesarca,项目名称:toolium,代码行数:13,代码来源:test_driver_wrapper.py
示例9: setUp
def setUp(self):
"""Create a new mock element and a new driver before each test"""
global mock_element
mock_element = mock.MagicMock(spec=WebElement)
mock_element.find_element.return_value = child_element
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
self.driver_wrapper.driver = mock.MagicMock()
开发者ID:cesarca,项目名称:toolium,代码行数:13,代码来源:test_page_element.py
示例10: __init__
def __init__(self):
if not DriverWrappersPool.is_empty():
# Copy config object and other properties from default driver
default_wrapper = DriverWrappersPool.get_default_wrapper()
self.config = default_wrapper.config.deepcopy()
self.logger = default_wrapper.logger
self.config_properties_filenames = default_wrapper.config_properties_filenames
self.config_log_filename = default_wrapper.config_log_filename
self.output_log_filename = default_wrapper.output_log_filename
self.visual_baseline_directory = default_wrapper.visual_baseline_directory
self.baseline_name = default_wrapper.baseline_name
# Create utils instance and add wrapper to the pool
self.utils = Utils(self)
DriverWrappersPool.add_wrapper(self)
开发者ID:jframos,项目名称:toolium,代码行数:15,代码来源:driver_wrapper.py
示例11: setUp
def setUp(self):
"""Create a new mock element and a new driver before each test"""
# Create a mock element
self.mock_element = mock.MagicMock(spec=WebElement)
self.mock_element.find_element.return_value = child_element
self.mock_element.text = 'text value'
self.mock_element.get_attribute.return_value = 'input text value'
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
self.driver_wrapper.driver = mock.MagicMock()
开发者ID:cesarca,项目名称:toolium,代码行数:15,代码来源:test_derived_page_element.py
示例12: tearDown
def tearDown(self):
# Call BasicTestCase tearDown
super(SeleniumTestCase, self).tearDown()
test_name = self.get_subclassmethod_name().replace('.', '_')
# Capture screenshot on error
if not self._test_passed:
DriverWrappersPool.capture_screenshots(test_name)
# Write Webdriver logs to files
self.utils.save_all_webdriver_logs(self.get_subclassmethod_name())
# Close browser and stop driver if it must not be reused
DriverWrappersPool.close_drivers_and_download_videos(test_name, self._test_passed, self.reuse_driver)
if not self.reuse_driver:
SeleniumTestCase.driver = None
开发者ID:ivanprjcts,项目名称:toolium,代码行数:16,代码来源:test_cases.py
示例13: driver_wrapper
def driver_wrapper():
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
new_driver_wrapper = DriverWrappersPool.get_default_wrapper()
# Configure wrapper
config_files = ConfigFiles()
root_path = os.path.dirname(os.path.realpath(__file__))
config_files.set_config_directory(os.path.join(root_path, 'conf'))
config_files.set_output_directory(os.path.join(root_path, 'output'))
config_files.set_config_log_filename('logging.conf')
new_driver_wrapper.configure(config_files)
return new_driver_wrapper
开发者ID:jframos,项目名称:toolium,代码行数:17,代码来源:test_driver_wrapper.py
示例14: __init__
def __init__(self, driver_wrapper=None):
"""Initialize Utils instance
:param driver_wrapper: driver wrapper instance
"""
self.driver_wrapper = driver_wrapper if driver_wrapper else DriverWrappersPool.get_default_wrapper()
# Configure logger
self.logger = logging.getLogger(__name__)
开发者ID:jframos,项目名称:toolium,代码行数:8,代码来源:utils.py
示例15: driver_wrapper
def driver_wrapper():
# Create a mock element
global mock_element
mock_element = mock.MagicMock(spec=WebElement)
mock_element.find_element.return_value = child_element
mock_element.text = 'text value'
mock_element.get_attribute.return_value = 'input text value'
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
driver_wrapper = DriverWrappersPool.get_default_wrapper()
driver_wrapper.driver = mock.MagicMock()
return driver_wrapper
开发者ID:jframos,项目名称:toolium,代码行数:17,代码来源:test_derived_page_element.py
示例16: driver_wrapper
def driver_wrapper():
# Create a new wrapper
new_driver_wrapper = DriverWrappersPool.get_default_wrapper()
# Configure wrapper
config_files = ConfigFiles()
root_path = os.path.dirname(os.path.realpath(__file__))
config_files.set_config_directory(os.path.join(root_path, 'conf'))
config_files.set_output_directory(os.path.join(root_path, 'output'))
DriverWrappersPool.configure_common_directories(config_files)
yield new_driver_wrapper
# Remove environment properties after test
try:
del os.environ["Config_log_filename"]
except KeyError:
pass
开发者ID:Telefonica,项目名称:toolium,代码行数:18,代码来源:test_driver_wrapper_logger.py
示例17: driver_wrapper
def driver_wrapper():
# Configure properties
config_files = ConfigFiles()
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
config_files.set_config_directory(os.path.join(root_path, 'conf'))
config_files.set_config_properties_filenames('properties.cfg')
driver_wrapper = DriverWrappersPool.get_default_wrapper()
driver_wrapper.configure(config_files)
return driver_wrapper
开发者ID:jframos,项目名称:toolium,代码行数:10,代码来源:test_mobile_page_object.py
示例18: setUp
def setUp(self):
# Reset wrappers pool values
DriverWrappersPool._empty_pool()
DriverWrapper.config_properties_filenames = None
# Create a new wrapper
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
self.driver_wrapper.driver = mock.MagicMock()
# Configure properties
self.root_path = os.path.dirname(os.path.realpath(__file__))
config_files = ConfigFiles()
config_files.set_config_directory(os.path.join(self.root_path, 'conf'))
config_files.set_config_properties_filenames('properties.cfg')
config_files.set_output_directory(os.path.join(self.root_path, 'output'))
self.driver_wrapper.configure(tc_config_files=config_files)
# Create a new Utils instance
self.utils = Utils()
开发者ID:ivanprjcts,项目名称:toolium,代码行数:19,代码来源:test_utils.py
示例19: configure
def configure(self, is_selenium_test=True, tc_config_files=ConfigFiles()):
"""Configure initial selenium instance using logging and properties files for Selenium or Appium tests
:param is_selenium_test: true if test is a selenium or appium test case
:param tc_config_files: test case specific config files
"""
# Configure config and output directories
DriverWrappersPool.configure_common_directories(tc_config_files)
# Configure logger
self.configure_logger(tc_config_files.config_log_filename, tc_config_files.output_log_filename)
# Initialize the config object
self.configure_properties(tc_config_files.config_properties_filenames)
# Configure visual directories
if is_selenium_test:
driver_info = self.config.get('Driver', 'type').replace('-', '_')
DriverWrappersPool.configure_visual_directories(driver_info)
self.configure_visual_baseline()
开发者ID:cesarca,项目名称:toolium,代码行数:20,代码来源:driver_wrapper.py
示例20: setUp
def setUp(self):
# Get default driver wrapper
self.driver_wrapper = DriverWrappersPool.get_default_wrapper()
if not SeleniumTestCase.driver:
# By default config directory is located in test path
if not self.config_files.config_directory:
self.config_files.set_config_directory(DriverWrappersPool.get_default_config_directory())
# Create driver
self.driver_wrapper.configure(True, self.config_files)
self.driver_wrapper.connect()
SeleniumTestCase.driver = self.driver_wrapper.driver
self.utils = self.driver_wrapper.utils
# Get common configuration of reusing driver
self.reuse_driver = self.driver_wrapper.config.getboolean_optional('Driver', 'reuse_driver')
# Set implicitly wait
self.utils.set_implicit_wait()
# Call BasicTestCase setUp
super(SeleniumTestCase, self).setUp()
开发者ID:cesarca,项目名称:toolium,代码行数:21,代码来源:test_cases.py
注:本文中的toolium.driver_wrappers_pool.DriverWrappersPool类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论