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


Python ConfigDriver._create_firefox_profile方法代码示例

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


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

示例1: test_create_firefox_profile

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_firefox_profile [as 别名]
def test_create_firefox_profile(webdriver_mock, config):
    config.add_section('Firefox')
    config.set('Firefox', 'profile', '/tmp')
    config.add_section('FirefoxPreferences')
    config.set('FirefoxPreferences', 'browser.download.folderList', '2')
    config.add_section('FirefoxExtensions')
    config.set('FirefoxExtensions', 'firebug', 'resources/firebug-3.0.0-beta.3.xpi')
    config_driver = ConfigDriver(config)

    config_driver._create_firefox_profile()
    webdriver_mock.FirefoxProfile.assert_called_once_with(profile_directory='/tmp')
    webdriver_mock.FirefoxProfile().set_preference.assert_called_once_with('browser.download.folderList', 2)
    webdriver_mock.FirefoxProfile().update_preferences.assert_called_once_with()
    webdriver_mock.FirefoxProfile().add_extension.assert_called_once_with('resources/firebug-3.0.0-beta.3.xpi')
开发者ID:jframos,项目名称:toolium,代码行数:16,代码来源:test_config_driver.py

示例2: test_create_local_driver_firefox

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_firefox_profile [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

示例3: test_create_local_driver_capabilities

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_firefox_profile [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

示例4: test_create_local_driver_firefox

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_firefox_profile [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

示例5: test_create_local_driver_firefox_gecko

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_firefox_profile [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

示例6: test_create_local_driver_firefox_binary

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_firefox_profile [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

示例7: test_create_remote_driver_firefox

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_firefox_profile [as 别名]
def test_create_remote_driver_firefox(webdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'firefox')
    config_driver = ConfigDriver(config)

    # Firefox profile mock
    class ProfileMock(object):
        encoded = 'encoded profile'

    config_driver._create_firefox_profile = mock.MagicMock(return_value=ProfileMock())

    config_driver._create_remote_driver()
    capabilities = DesiredCapabilities.FIREFOX.copy()
    capabilities['firefox_profile'] = 'encoded profile'
    webdriver_mock.Remote.assert_called_once_with(command_executor='http://10.20.30.40:5555/wd/hub',
                                                  desired_capabilities=capabilities)
开发者ID:jframos,项目名称:toolium,代码行数:19,代码来源:test_config_driver.py

示例8: test_create_local_driver_firefox_binary

# 需要导入模块: from toolium.config_driver import ConfigDriver [as 别名]
# 或者: from toolium.config_driver.ConfigDriver import _create_firefox_profile [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_firefox_profile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。