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


Python config_driver.ConfigDriver类代码示例

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


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

示例1: test_create_local_driver_edge

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,代码行数:7,代码来源:test_config_driver.py

示例2: test_create_local_driver_iphone

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,代码行数:7,代码来源:test_config_driver.py

示例3: test_create_local_driver_unknown_driver

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,代码行数:7,代码来源:test_config_driver.py

示例4: test_create_local_driver_iexplore

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,代码行数:7,代码来源:test_config_driver.py

示例5: test_add_firefox_arguments

def test_add_firefox_arguments(config):
    config.add_section('FirefoxArguments')
    config.set('FirefoxArguments', '-private', '')
    config_driver = ConfigDriver(config)
    firefox_options = Options()

    config_driver._add_firefox_arguments(firefox_options)
    assert firefox_options.arguments == ['-private']
开发者ID:jframos,项目名称:toolium,代码行数:8,代码来源:test_config_driver.py

示例6: test_create_local_driver_phantomjs

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,代码行数:8,代码来源:test_config_driver.py

示例7: test_create_local_driver_opera

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,代码行数:8,代码来源:test_config_driver.py

示例8: test_create_local_driver_chrome

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,代码行数:9,代码来源:test_config_driver.py

示例9: test_create_local_driver_firefox

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,代码行数:9,代码来源:test_config_driver.py

示例10: test_create_driver_local_not_configured

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,代码行数:9,代码来源:test_config_driver.py

示例11: test_create_remote_driver_phantomjs

def test_create_remote_driver_phantomjs(webdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'phantomjs')
    config_driver = ConfigDriver(config)

    config_driver._create_remote_driver()
    webdriver_mock.Remote.assert_called_once_with(command_executor='http://10.20.30.40:5555/wd/hub',
                                                  desired_capabilities=DesiredCapabilities.PHANTOMJS)
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py

示例12: test_create_remote_driver_iexplore

def test_create_remote_driver_iexplore(webdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'iexplore')
    config_driver = ConfigDriver(config)

    config_driver._create_remote_driver()
    webdriver_mock.Remote.assert_called_once_with(command_executor='http://10.20.30.40:5555/wd/hub',
                                                  desired_capabilities=DesiredCapabilities.INTERNETEXPLORER)
开发者ID:jframos,项目名称:toolium,代码行数:9,代码来源:test_config_driver.py

示例13: test_create_driver_remote

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,代码行数:10,代码来源:test_config_driver.py

示例14: test_create_chrome_options_headless

def test_create_chrome_options_headless(webdriver_mock, config):
    config.set('Driver', 'headless', 'true')
    config_driver = ConfigDriver(config)

    config_driver._create_chrome_options()
    webdriver_mock.ChromeOptions.assert_called_once_with()
    if os.name == 'nt':
        webdriver_mock.ChromeOptions().add_argument.assert_has_calls([mock.call('--headless'),
                                                                      mock.call('--disable-gpu')])
    else:
        webdriver_mock.ChromeOptions().add_argument.assert_called_once_with('--headless')
开发者ID:jframos,项目名称:toolium,代码行数:11,代码来源:test_config_driver.py

示例15: test_create_remote_driver_opera

def test_create_remote_driver_opera(webdriver_mock, config):
    config.set('Server', 'host', '10.20.30.40')
    config.set('Server', 'port', '5555')
    config.set('Driver', 'type', 'opera')
    config_driver = ConfigDriver(config)

    config_driver._create_remote_driver()
    capabilities = DesiredCapabilities.OPERA
    capabilities['opera.autostart'] = True
    capabilities['opera.arguments'] = '-fullscreen'
    webdriver_mock.Remote.assert_called_once_with(command_executor='http://10.20.30.40:5555/wd/hub',
                                                  desired_capabilities=capabilities)
开发者ID:jframos,项目名称:toolium,代码行数:12,代码来源:test_config_driver.py


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