当前位置: 首页>>代码示例>>Python>>正文


Python ConfigDriver._create_local_driver方法代码示例

本文整理汇总了Python中toolium.config_driver.ConfigDriver._create_local_driver方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigDriver._create_local_driver方法的具体用法?Python ConfigDriver._create_local_driver怎么用?Python ConfigDriver._create_local_driver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在toolium.config_driver.ConfigDriver的用法示例。


在下文中一共展示了ConfigDriver._create_local_driver方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_create_local_driver_edge

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_edge(webdriver_mock, config):
    config.set('Driver', 'type', 'edge')
    config.set('Driver', 'edge_driver_path', '/tmp/driver')
    config_driver = ConfigDriver(config)

    config_driver._create_local_driver()
    webdriver_mock.Edge.assert_called_once_with('/tmp/driver', capabilities=DesiredCapabilities.EDGE)
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py

示例2: test_create_local_driver_unknown_driver

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_unknown_driver(config):
    config.set('Driver', 'type', 'unknown')
    config_driver = ConfigDriver(config)

    with pytest.raises(Exception) as excinfo:
        config_driver._create_local_driver()
    assert 'Unknown driver unknown' == str(excinfo.value)
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py

示例3: test_create_local_driver_iexplore

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_iexplore(webdriver_mock, config):
    config.set('Driver', 'type', 'iexplore')
    config.set('Driver', 'explorer_driver_path', '/tmp/driver')
    config_driver = ConfigDriver(config)

    config_driver._create_local_driver()
    webdriver_mock.Ie.assert_called_once_with('/tmp/driver', capabilities=DesiredCapabilities.INTERNETEXPLORER)
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py

示例4: test_create_local_driver_phantomjs

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_phantomjs(webdriver_mock, config):
    config.set('Driver', 'type', 'phantomjs')
    config.set('Driver', 'phantomjs_driver_path', '/tmp/driver')
    config_driver = ConfigDriver(config)

    config_driver._create_local_driver()
    webdriver_mock.PhantomJS.assert_called_once_with(desired_capabilities=DesiredCapabilities.PHANTOMJS,
                                                     executable_path='/tmp/driver')
开发者ID:jframos,项目名称:toolium,代码行数:10,代码来源:test_config_driver.py

示例5: test_create_local_driver_opera

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_opera(webdriver_mock, config):
    config.set('Driver', 'type', 'opera')
    config.set('Driver', 'opera_driver_path', '/tmp/driver')
    config_driver = ConfigDriver(config)

    config_driver._create_local_driver()
    webdriver_mock.Opera.assert_called_once_with(desired_capabilities=DesiredCapabilities.OPERA,
                                                 executable_path='/tmp/driver')
开发者ID:jframos,项目名称:toolium,代码行数:10,代码来源:test_config_driver.py

示例6: test_create_local_driver_chrome

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_chrome(webdriver_mock, config):
    config.set('Driver', 'type', 'chrome')
    config.set('Driver', 'chrome_driver_path', '/tmp/driver')
    config_driver = ConfigDriver(config)
    config_driver._create_chrome_options = lambda: 'chrome options'

    config_driver._create_local_driver()
    webdriver_mock.Chrome.assert_called_once_with('/tmp/driver', desired_capabilities=DesiredCapabilities.CHROME,
                                                  chrome_options='chrome options')
开发者ID:jframos,项目名称:toolium,代码行数:11,代码来源:test_config_driver.py

示例7: test_create_local_driver_firefox

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_firefox(webdriver_mock, config):
    config.set('Driver', 'type', 'firefox')
    config_driver = ConfigDriver(config)
    config_driver._create_firefox_profile = lambda: 'firefox profile'

    config_driver._create_local_driver()
    webdriver_mock.Firefox.assert_called_once_with(capabilities=DesiredCapabilities.FIREFOX,
                                                   firefox_profile='firefox profile', executable_path=None,
                                                   firefox_options=None)
开发者ID:Telefonica,项目名称:toolium,代码行数:11,代码来源:test_config_driver.py

示例8: test_create_local_driver_capabilities

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_capabilities(webdriver_mock, config):
    config.set('Driver', 'type', 'firefox')
    config.add_section('Capabilities')
    config.set('Capabilities', 'version', '45')
    config_driver = ConfigDriver(config)
    config_driver._create_firefox_profile = lambda: 'firefox profile'

    config_driver._create_local_driver()
    capabilities = DesiredCapabilities.FIREFOX.copy()
    capabilities['version'] = '45'
    webdriver_mock.Firefox.assert_called_once_with(capabilities=capabilities,
                                                   firefox_profile='firefox profile', executable_path=None,
                                                   firefox_options=None)
开发者ID:Telefonica,项目名称:toolium,代码行数:15,代码来源:test_config_driver.py

示例9: test_create_local_driver_firefox

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_firefox(webdriver_mock, options, config):
    config.set('Driver', 'type', 'firefox')
    config.add_section('Capabilities')
    config.set('Capabilities', 'marionette', 'false')
    config_driver = ConfigDriver(config)
    config_driver._create_firefox_profile = lambda: 'firefox profile'
    DriverWrappersPool.output_directory = ''

    config_driver._create_local_driver()
    expected_capabilities = DesiredCapabilities.FIREFOX.copy()
    expected_capabilities['marionette'] = False
    webdriver_mock.Firefox.assert_called_once_with(capabilities=expected_capabilities,
                                                   firefox_profile='firefox profile', executable_path=None,
                                                   firefox_options=options(), log_path='geckodriver.log')
开发者ID:jframos,项目名称:toolium,代码行数:16,代码来源:test_config_driver.py

示例10: test_create_local_driver_firefox_gecko

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_firefox_gecko(webdriver_mock, config):
    config.set('Driver', 'type', 'firefox')
    config.add_section('Capabilities')
    config.set('Capabilities', 'marionette', 'true')
    config.set('Driver', 'gecko_driver_path', '/tmp/driver')
    config_driver = ConfigDriver(config)
    config_driver._create_firefox_profile = lambda: 'firefox profile'

    config_driver._create_local_driver()
    expected_capabilities = DesiredCapabilities.FIREFOX.copy()
    expected_capabilities['marionette'] = True
    webdriver_mock.Firefox.assert_called_once_with(capabilities=expected_capabilities,
                                                   firefox_profile='firefox profile', executable_path='/tmp/driver',
                                                   firefox_options=None)
开发者ID:Telefonica,项目名称:toolium,代码行数:16,代码来源:test_config_driver.py

示例11: test_create_local_driver_firefox_binary

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_firefox_binary(webdriver_mock, config):
    config.set('Driver', 'type', 'firefox')
    config.add_section('Firefox')
    config.set('Firefox', 'binary', '/tmp/firefox')
    config_driver = ConfigDriver(config)
    config_driver._create_firefox_profile = lambda: 'firefox profile'

    config_driver._create_local_driver()

    # Check that firefox options contain the firefox binary
    args, kwargs = webdriver_mock.Firefox.call_args
    firefox_options = kwargs['firefox_options']
    assert isinstance(firefox_options, Options)
    assert firefox_options.binary == '/tmp/firefox'
开发者ID:Telefonica,项目名称:toolium,代码行数:16,代码来源:test_config_driver.py

示例12: test_create_local_driver_iphone

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_iphone(config):
    config.set('Driver', 'type', 'iphone')
    config_driver = ConfigDriver(config)
    config_driver._create_remote_driver = lambda: 'remote driver mock'

    driver = config_driver._create_local_driver()
    assert driver == 'remote driver mock'
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py

示例13: test_create_driver_local_not_configured

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_driver_local_not_configured(config):
    config.set('Driver', 'type', 'firefox')
    config_driver = ConfigDriver(config)
    config_driver._create_local_driver = lambda: 'local driver mock'
    config_driver._create_remote_driver = lambda: 'remote driver mock'

    driver = config_driver.create_driver()

    assert driver == 'local driver mock'
开发者ID:jframos,项目名称:toolium,代码行数:11,代码来源:test_config_driver.py

示例14: test_create_driver_remote

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_driver_remote(config):
    config.set('Server', 'enabled', 'true')
    config.set('Driver', 'type', 'firefox')
    config_driver = ConfigDriver(config)
    config_driver._create_local_driver = lambda: 'local driver mock'
    config_driver._create_remote_driver = lambda: 'remote driver mock'

    driver = config_driver.create_driver()

    assert driver == 'remote driver mock'
开发者ID:jframos,项目名称:toolium,代码行数:12,代码来源:test_config_driver.py

示例15: test_create_local_driver_firefox_binary

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_local_driver [as 别名]
def test_create_local_driver_firefox_binary(webdriver_mock, config):
    config.set('Driver', 'type', 'firefox')
    config.add_section('Capabilities')
    config.set('Capabilities', 'marionette', 'false')
    config.add_section('Firefox')
    config.set('Firefox', 'binary', '/tmp/firefox')
    config_driver = ConfigDriver(config)
    config_driver._create_firefox_profile = lambda: 'firefox profile'
    DriverWrappersPool.output_directory = ''

    config_driver._create_local_driver()

    # Check that firefox options contain the firefox binary
    args, kwargs = webdriver_mock.Firefox.call_args
    firefox_options = kwargs['firefox_options']
    assert isinstance(firefox_options, Options)
    if isinstance(firefox_options.binary, str):
        assert firefox_options.binary == '/tmp/firefox'  # Selenium 2
    else:
        assert firefox_options.binary._start_cmd == '/tmp/firefox'  # Selenium 3
开发者ID:jframos,项目名称:toolium,代码行数:22,代码来源:test_config_driver.py


注:本文中的toolium.config_driver.ConfigDriver._create_local_driver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。